diff roundup/cgi/client.py @ 4739:94be76e04140

templating: Move template selection logic from the template loaders to the client.
author anatoly techtonik <techtonik@gmail.com>
date Mon, 14 Jan 2013 20:25:00 +0300
parents 4caa6de726a5
children fe9568a6cbd6
line wrap: on
line diff
--- a/roundup/cgi/client.py	Mon Jan 14 19:57:42 2013 +0300
+++ b/roundup/cgi/client.py	Mon Jan 14 20:25:00 2013 +0300
@@ -1063,11 +1063,23 @@
         self.error_message.append(message)
         self.write_html(self.renderContext())
 
+    def selectTemplate(self):
+        """ Template selection logic """
+        loader = self.instance.templates
+
+        name = self.classname
+        view = self.template
+        
+        # if classname is not set, use "home" template
+        if name is None:
+            name = 'home'
+
+        return name, view
+
     def renderContext(self):
         """ Return a PageTemplate for the named page
         """
-        name = self.classname
-        view = self.template
+        name, view = self.selectTemplate()
 
         # catch errors so we can handle PT rendering errors more nicely
         args = {

Roundup Issue Tracker: http://roundup-tracker.org/