--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/page.py Fri Feb 06 20:49:29 2009 +0200
@@ -0,0 +1,59 @@
+
+class Page (object) :
+ """
+ A page is kind of like a controller, I guess
+ """
+
+ # the page title, used in the HTML <title>
+ title = None
+
+ # the page name, used in the menu
+ name = None
+
+ # the page path, used in the URL
+ path = None
+
+ # parent page, can be self
+ parent = None
+
+ # menu of sub-pages, may be empty
+ menu = None
+
+ def __init__ (self, req, path_suffix) :
+ self.req = req
+ self.path_suffix = path_suffix
+
+ # default parent to root
+ if not self.parent :
+ from pages import index as index_page
+
+ self.parent = index_page.Page
+
+ def _build_template (self, template_class) :
+ tpl = template_class(searchList=[self.req])
+
+ tpl.page_title = self.title
+ tpl.page_name = self.name
+ tpl.page_path = self.path
+
+ tpl.page_menu = self.menu
+ tpl.page = self
+
+ return tpl
+
+ def get_response_code (self) :
+ """
+ Returns the HTTP response code to be used
+ """
+
+ return 200
+
+ def render_template (self) :
+ """
+ Returns an instance of Cheetah.Template, prepopulated with whatever variables it needs, ready to be rendered
+ """
+
+ abstract
+
+
+