Back to index

moin  1.9.0~rc2
modernized_cms.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     MoinMoin - modernized_cms theme
00004 
00005     @copyright: 2009 MoinMoin:ThomasWaldmann
00006     @license: GNU GPL, see COPYING for details.
00007 """
00008 
00009 from MoinMoin.theme.modernized import Theme as ThemeBase
00010 
00011 class Theme(ThemeBase):
00012 
00013     name = "modernized" # we tell that we are 'modernized', so we use its static data
00014 
00015     def onlyloggedin(method):
00016         """ decorator that returns empty string for not logged-in users,
00017             otherwise it calls the decorated method
00018         """
00019         return lambda self, *args, **kwargs: (
00020             self.request.user.valid and self.request.user.name and method(self, *args, **kwargs)
00021             or
00022             ''
00023             )
00024 
00025     interwiki = onlyloggedin(ThemeBase.interwiki)
00026     title = onlyloggedin(ThemeBase.title)
00027     username = onlyloggedin(ThemeBase.username)
00028     pageinfo = onlyloggedin(ThemeBase.pageinfo)
00029     editbar = onlyloggedin(ThemeBase.editbar)
00030 
00031 
00032 def execute(request):
00033     return Theme(request)
00034