lib/handler.py
changeset 8 0ce1f471e9d7
parent 7 d6a8258bd90e
child 9 2a47b00f60b0
--- a/lib/handler.py	Fri Feb 06 21:31:02 2009 +0200
+++ b/lib/handler.py	Fri Feb 06 22:48:00 2009 +0200
@@ -2,12 +2,26 @@
     The actual application behaviour, i.e. generating a Response from a Request :)
 """
 
-import http, page
+import http, page, template
 
 def handle_request (request) :
     """
         Take the Request, and return a Response
     """
 
-    return http.Response("Hello World")
+    # determine the page name
+    page_name = request.get_page_name()
 
+    # get the page handler
+    p = page.lookup(page_name)
+
+    # render the template
+    response_data = template.render("layout",
+        site_root_url   = request.get_script_dir(),
+        page_title      = p.get_title(),
+        page_content    = p.get_content(),
+    )
+    
+    # return the response
+    return http.Response(response_data)
+