changeset 4635:716dcfb00e8e

added modernized_cms theme
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 07 Mar 2009 21:49:55 +0100
parents 28a5a548d6f5
children 83483f4e26cb 641b595ce675
files MoinMoin/theme/modernized_cms.py
diffstat 1 files changed, 34 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/theme/modernized_cms.py	Sat Mar 07 21:49:55 2009 +0100
@@ -0,0 +1,34 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - modernized_cms theme
+
+    @copyright: 2009 MoinMoin:ThomasWaldmann
+    @license: GNU GPL, see COPYING for details.
+"""
+
+from MoinMoin.theme.modernized import Theme as ThemeBase
+
+class Theme(ThemeBase):
+
+    name = "modernized" # we tell that we are 'modernized', so we use its static data
+
+    def onlyloggedin(method):
+        """ decorator that returns empty string for not logged-in users,
+            otherwise it calls the decorated method
+        """
+        return lambda self, *args, **kwargs: (
+            self.request.user.valid and self.request.user.name and method(self, *args, **kwargs)
+            or
+            ''
+            )
+
+    interwiki = onlyloggedin(ThemeBase.interwiki)
+    title = onlyloggedin(ThemeBase.title)
+    username = onlyloggedin(ThemeBase.username)
+    pageinfo = onlyloggedin(ThemeBase.pageinfo)
+    editbar = onlyloggedin(ThemeBase.editbar)
+
+
+def execute(request):
+    return Theme(request)
+