exodus: Move some exodus-specific code out of the site theme.
authorMatthijs Kooijman <matthijs@stdin.nl>
Mon, 19 Apr 2010 14:55:23 +0000 (16:55 +0200)
committerMatthijs Kooijman <matthijs@stdin.nl>
Mon, 19 Apr 2010 15:03:03 +0000 (17:03 +0200)
plugin/theme/exodus.py
plugin/theme/site.py

index 5a27ef5023541eccb67d398c0dff6d235ae26868..498e1f6dbf25868aaf1d1d2f94f1fbb8a5dd7452 100644 (file)
@@ -6,6 +6,7 @@
 """
 
 from site import SiteTheme
+from MoinMoin.theme import ThemeBase
 
 class Theme(SiteTheme):
 
@@ -23,6 +24,22 @@ class Theme(SiteTheme):
 
         return '\n'.join(html)
 
+    def startPage(self, d):
+        # For the homepage, don't use SiteTheme's changes
+        if d['page'].page_name == 'Site':
+            return ThemeBase.startPage(self)
+        else:
+            return SiteTheme.startPage(self, d)
+
+    def endPage(self, d):
+        # For the homepage, don't use SiteTheme's changes, but also don't use
+        # ThemeBase, since that adds a #pagebottom.
+        if d['page'].page_name == 'Site':
+            return u'</div><!-- #page -->'
+        else:
+            return SiteTheme.endPage(self, d)
+
+
 def execute(request):
     """
     Generate and return a theme object
index 683272d6d62ed27922467ecdff212fcf841569c3..e3288c21a0e0e74aac695ebd8a4047dbeaf8f736 100644 (file)
@@ -170,20 +170,16 @@ class SiteTheme(ThemeBase):
         return html
 
     def startPage(self, d):
+        # This opens up #page
         html = ThemeBase.startPage(self)
-        if d['page'].page_name != 'Site':
-            html += u'<div id="pagetop"></div>\n'
-            html += u'<div id="pagemiddle">'
+        html += u'<div id="pagetop"></div>\n'
+        html += u'<div id="pagemiddle">\n'
         return html
 
     def endPage(self, d):
-        if d['page'].page_name != 'Site':
-            html = u'</div><!-- #pagemiddle -->'
-            html += u'<div id=pagebottom></div>'
-            html += u'</div>'
-        else:
-            html = u'</div>'
-        #html += ThemeBase.endPage(self)
+        html = u'</div><!-- #pagemiddle -->\n'
+        html += ThemeBase.endPage(self)
+        # This adds #pagebottom and closes #page
         return html
 
 def execute(request):