lib/page.py
changeset 7 d6a8258bd90e
parent 6 5565d94da522
child 8 0ce1f471e9d7
--- a/lib/page.py	Fri Feb 06 20:49:29 2009 +0200
+++ b/lib/page.py	Fri Feb 06 21:31:02 2009 +0200
@@ -1,59 +1,21 @@
 
-class Page (object) :
+"""
+    Handling page requests
+"""
+
+def handle_html (env) :
+    return "A HTML page"
+
+
+# list of page handlers, by type
+type_handlers = [
+    ('.html',   handle_html),
+]
+
+def lookup_handler (path) :
     """
-        A page is kind of like a controller, I guess
+        Look up and return a handler for the given page, or raise an error
     """
 
-    # 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
+    return handle_html
 
-            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
-
-
-