~ubuntu-branches/ubuntu/intrepid/prewikka/intrepid

« back to all changes in this revision

Viewing changes to prewikka/templates/ClassicLayout.py

  • Committer: Bazaar Package Importer
  • Author(s): Pierre Chifflier
  • Date: 2007-04-11 14:41:09 UTC
  • Revision ID: james.westby@ubuntu.com-20070411144109-2hh7zx3amwd27b4l
Tags: upstream-0.9.10
ImportĀ upstreamĀ versionĀ 0.9.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
 
 
4
 
 
5
 
 
6
##################################################
 
7
## DEPENDENCIES
 
8
import sys
 
9
import os
 
10
import os.path
 
11
from os.path import getmtime, exists
 
12
import time
 
13
import types
 
14
import __builtin__
 
15
from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
 
16
from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
 
17
from Cheetah.Template import Template
 
18
from Cheetah.DummyTransaction import DummyTransaction
 
19
from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
 
20
from Cheetah.CacheRegion import CacheRegion
 
21
import Cheetah.Filters as Filters
 
22
import Cheetah.ErrorCatchers as ErrorCatchers
 
23
from prewikka.templates.TopLayout import TopLayout
 
24
 
 
25
##################################################
 
26
## MODULE CONSTANTS
 
27
try:
 
28
    True, False
 
29
except NameError:
 
30
    True, False = (1==1), (1==0)
 
31
VFFSL=valueFromFrameOrSearchList
 
32
VFSL=valueFromSearchList
 
33
VFN=valueForName
 
34
currentTime=time.time
 
35
__CHEETAH_version__ = '2.0rc7'
 
36
__CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 7)
 
37
__CHEETAH_genTime__ = 1175011473.104785
 
38
__CHEETAH_genTimestamp__ = 'Tue Mar 27 18:04:33 2007'
 
39
__CHEETAH_src__ = 'prewikka/templates/ClassicLayout.tmpl'
 
40
__CHEETAH_srcLastModified__ = 'Tue Mar 27 18:04:24 2007'
 
41
__CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
 
42
 
 
43
if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
 
44
    raise AssertionError(
 
45
      'This template was compiled with Cheetah version'
 
46
      ' %s. Templates compiled before version %s must be recompiled.'%(
 
47
         __CHEETAH_version__, RequiredCheetahVersion))
 
48
 
 
49
##################################################
 
50
## CLASSES
 
51
 
 
52
class ClassicLayout(TopLayout):
 
53
 
 
54
    ##################################################
 
55
    ## CHEETAH GENERATED METHODS
 
56
 
 
57
 
 
58
    def __init__(self, *args, **KWs):
 
59
 
 
60
        TopLayout.__init__(self, *args, **KWs)
 
61
        if not self._CHEETAH__instanceInitialized:
 
62
            cheetahKWArgs = {}
 
63
            allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
 
64
            for k,v in KWs.items():
 
65
                if k in allowedKWs: cheetahKWArgs[k] = v
 
66
            self._initCheetahInstance(**cheetahKWArgs)
 
67
        
 
68
 
 
69
    def body_class(self, **KWS):
 
70
 
 
71
 
 
72
 
 
73
        ## CHEETAH: generated from #def body_class() at line 3, col 1.
 
74
        trans = KWS.get("trans")
 
75
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
 
76
            trans = self.transaction # is None unless self.awake() was called
 
77
        if not trans:
 
78
            trans = DummyTransaction()
 
79
            _dummyTrans = True
 
80
        else: _dummyTrans = False
 
81
        write = trans.response().write
 
82
        SL = self._CHEETAH__searchList
 
83
        _filter = self._CHEETAH__currentFilter
 
84
        
 
85
        ########################################
 
86
        ## START - generated method body
 
87
        
 
88
        write('classic_body\n')
 
89
        
 
90
        ########################################
 
91
        ## END - generated method body
 
92
        
 
93
        return _dummyTrans and trans.response().getvalue() or ""
 
94
        
 
95
 
 
96
    def layout_start_hook(self, **KWS):
 
97
 
 
98
 
 
99
 
 
100
        ## CHEETAH: generated from #def layout_start_hook at line 35, col 1.
 
101
        trans = KWS.get("trans")
 
102
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
 
103
            trans = self.transaction # is None unless self.awake() was called
 
104
        if not trans:
 
105
            trans = DummyTransaction()
 
106
            _dummyTrans = True
 
107
        else: _dummyTrans = False
 
108
        write = trans.response().write
 
109
        SL = self._CHEETAH__searchList
 
110
        _filter = self._CHEETAH__currentFilter
 
111
        
 
112
        ########################################
 
113
        ## START - generated method body
 
114
        
 
115
        
 
116
        ########################################
 
117
        ## END - generated method body
 
118
        
 
119
        return _dummyTrans and trans.response().getvalue() or ""
 
120
        
 
121
 
 
122
    def menu_extra_content(self, **KWS):
 
123
 
 
124
 
 
125
 
 
126
        ## CHEETAH: generated from #def menu_extra_content at line 53, col 3.
 
127
        trans = KWS.get("trans")
 
128
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
 
129
            trans = self.transaction # is None unless self.awake() was called
 
130
        if not trans:
 
131
            trans = DummyTransaction()
 
132
            _dummyTrans = True
 
133
        else: _dummyTrans = False
 
134
        write = trans.response().write
 
135
        SL = self._CHEETAH__searchList
 
136
        _filter = self._CHEETAH__currentFilter
 
137
        
 
138
        ########################################
 
139
        ## START - generated method body
 
140
        
 
141
        
 
142
        ########################################
 
143
        ## END - generated method body
 
144
        
 
145
        return _dummyTrans and trans.response().getvalue() or ""
 
146
        
 
147
 
 
148
    def layout_end_hook(self, **KWS):
 
149
 
 
150
 
 
151
 
 
152
        ## CHEETAH: generated from #def layout_end_hook at line 60, col 1.
 
153
        trans = KWS.get("trans")
 
154
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
 
155
            trans = self.transaction # is None unless self.awake() was called
 
156
        if not trans:
 
157
            trans = DummyTransaction()
 
158
            _dummyTrans = True
 
159
        else: _dummyTrans = False
 
160
        write = trans.response().write
 
161
        SL = self._CHEETAH__searchList
 
162
        _filter = self._CHEETAH__currentFilter
 
163
        
 
164
        ########################################
 
165
        ## START - generated method body
 
166
        
 
167
        
 
168
        ########################################
 
169
        ## END - generated method body
 
170
        
 
171
        return _dummyTrans and trans.response().getvalue() or ""
 
172
        
 
173
 
 
174
    def toplayout_content(self, **KWS):
 
175
 
 
176
 
 
177
 
 
178
        ## CHEETAH: generated from #block toplayout_content at line 7, col 1.
 
179
        trans = KWS.get("trans")
 
180
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
 
181
            trans = self.transaction # is None unless self.awake() was called
 
182
        if not trans:
 
183
            trans = DummyTransaction()
 
184
            _dummyTrans = True
 
185
        else: _dummyTrans = False
 
186
        write = trans.response().write
 
187
        SL = self._CHEETAH__searchList
 
188
        _filter = self._CHEETAH__currentFilter
 
189
        
 
190
        ########################################
 
191
        ## START - generated method body
 
192
        
 
193
        _orig_filter_71218738 = _filter
 
194
        filterName = 'CleanOutput'
 
195
        if self._CHEETAH__filters.has_key("CleanOutput"):
 
196
            _filter = self._CHEETAH__currentFilter = self._CHEETAH__filters[filterName]
 
197
        else:
 
198
            _filter = self._CHEETAH__currentFilter = \
 
199
                        self._CHEETAH__filters[filterName] = getattr(self._CHEETAH__filtersLib, filterName)(self).filter
 
200
        write('\n<div id="topmenu">\n')
 
201
        for name, link in VFFSL(SL,"interface.tabs",True): # generated from line 11, col 3
 
202
            if VFFSL(SL,"name",True) == VFFSL(SL,"interface.active_tab",True): # generated from line 12, col 5
 
203
                class_ = 'topmenu_item_active'
 
204
            else: # generated from line 14, col 5
 
205
                class_ = 'topmenu_item_inactive'
 
206
            write('    <div class="')
 
207
            _v = VFFSL(SL,"class_",True) # '$class_' on line 17, col 17
 
208
            if _v is not None: write(_filter(_v, rawExpr='$class_')) # from line 17, col 17.
 
209
            write('"><p><a href="')
 
210
            _v = VFFSL(SL,"link",True) # '$link' on line 17, col 38
 
211
            if _v is not None: write(_filter(_v, rawExpr='$link')) # from line 17, col 38.
 
212
            write('">')
 
213
            _v = VFFSL(SL,"name",True) # '$name' on line 17, col 45
 
214
            if _v is not None: write(_filter(_v, rawExpr='$name')) # from line 17, col 45.
 
215
            write('</a></p></div>\n')
 
216
        write('\n  <div class="topmenu_item_special">\n')
 
217
        if VFFSL(SL,"prewikka.logout_link",True): # generated from line 21, col 3
 
218
            write('    <p><a href="')
 
219
            _v = VFFSL(SL,"prewikka.logout_link",True) # '$prewikka.logout_link' on line 22, col 17
 
220
            if _v is not None: write(_filter(_v, rawExpr='$prewikka.logout_link')) # from line 22, col 17.
 
221
            write('">')
 
222
            if False:
 
223
                _("logout")
 
224
            _v = VFFSL(SL,"_",False)("logout") # '$_("logout")' on line 22, col 40
 
225
            if _v is not None: write(_filter(_v, rawExpr='$_("logout")')) # from line 22, col 40.
 
226
            write('</a></p>\n')
 
227
        write('''  </div>
 
228
 
 
229
  <div class="topmenu_item_info">
 
230
''')
 
231
        if VFFSL(SL,"prewikka.user",True): # generated from line 27, col 5
 
232
            write('     <p><b><a href="?view=user_settings_display">')
 
233
            _v = VFFSL(SL,"prewikka.user.login",True) # '$prewikka.user.login' on line 28, col 50
 
234
            if _v is not None: write(_filter(_v, rawExpr='$prewikka.user.login')) # from line 28, col 50.
 
235
            write('</a></b> on ')
 
236
            _v = VFFSL(SL,"prewikka.date",True) # '$prewikka.date' on line 28, col 82
 
237
            if _v is not None: write(_filter(_v, rawExpr='$prewikka.date')) # from line 28, col 82.
 
238
            write('</p>\n')
 
239
        write('  </div>\n</div>\n')
 
240
        _filter = _orig_filter_71218738
 
241
        _orig_filter_20396549 = _filter
 
242
        filterName = 'Filter'
 
243
        if self._CHEETAH__filters.has_key("Filter"):
 
244
            _filter = self._CHEETAH__currentFilter = self._CHEETAH__filters[filterName]
 
245
        else:
 
246
            _filter = self._CHEETAH__currentFilter = \
 
247
                        self._CHEETAH__filters[filterName] = getattr(self._CHEETAH__filtersLib, filterName)(self).filter
 
248
        write('\n')
 
249
        _v = VFFSL(SL,"layout_start_hook",True) # '$layout_start_hook' on line 37, col 1
 
250
        if _v is not None: write(_filter(_v, rawExpr='$layout_start_hook')) # from line 37, col 1.
 
251
        write('\n\n')
 
252
        _filter = _orig_filter_20396549
 
253
        _orig_filter_83178734 = _filter
 
254
        filterName = 'CleanOutput'
 
255
        if self._CHEETAH__filters.has_key("CleanOutput"):
 
256
            _filter = self._CHEETAH__currentFilter = self._CHEETAH__filters[filterName]
 
257
        else:
 
258
            _filter = self._CHEETAH__currentFilter = \
 
259
                        self._CHEETAH__filters[filterName] = getattr(self._CHEETAH__filtersLib, filterName)(self).filter
 
260
        write('<div id="menu">\n')
 
261
        for name, link in VFFSL(SL,"interface.sections",True): # generated from line 42, col 3
 
262
            if VFFSL(SL,"name",True) == VFFSL(SL,"interface.active_section",True): # generated from line 43, col 5
 
263
                class_ = 'menu_item_active'
 
264
            else: # generated from line 45, col 5
 
265
                class_ = 'menu_item_inactive'
 
266
            write('    <a class="')
 
267
            _v = VFFSL(SL,"class_",True) # '$class_' on line 48, col 15
 
268
            if _v is not None: write(_filter(_v, rawExpr='$class_')) # from line 48, col 15.
 
269
            write('" href="')
 
270
            _v = VFFSL(SL,"link",True) # '$link' on line 48, col 30
 
271
            if _v is not None: write(_filter(_v, rawExpr='$link')) # from line 48, col 30.
 
272
            write('">')
 
273
            _v = VFFSL(SL,"name",True) # '$name' on line 48, col 37
 
274
            if _v is not None: write(_filter(_v, rawExpr='$name')) # from line 48, col 37.
 
275
            write('</a>\n')
 
276
        write('\n')
 
277
        _filter = _orig_filter_83178734
 
278
        _orig_filter_80288541 = _filter
 
279
        filterName = 'Filter'
 
280
        if self._CHEETAH__filters.has_key("Filter"):
 
281
            _filter = self._CHEETAH__currentFilter = self._CHEETAH__filters[filterName]
 
282
        else:
 
283
            _filter = self._CHEETAH__currentFilter = \
 
284
                        self._CHEETAH__filters[filterName] = getattr(self._CHEETAH__filtersLib, filterName)(self).filter
 
285
        write('  ')
 
286
        _v = VFFSL(SL,"menu_extra_content",True) # '$menu_extra_content' on line 55, col 3
 
287
        if _v is not None: write(_filter(_v, rawExpr='$menu_extra_content')) # from line 55, col 3.
 
288
        write('''
 
289
</div>
 
290
 
 
291
<div id="main">''')
 
292
        _v = VFFSL(SL,"main_content",True) # '$main_content' on line 58, col 16
 
293
        if _v is not None: write(_filter(_v, rawExpr='$main_content')) # from line 58, col 16.
 
294
        write('</div>\n\n')
 
295
        _v = VFFSL(SL,"layout_end_hook",True) # '$layout_end_hook' on line 62, col 1
 
296
        if _v is not None: write(_filter(_v, rawExpr='$layout_end_hook')) # from line 62, col 1.
 
297
        write('\n\n')
 
298
        _filter = _orig_filter_80288541
 
299
        
 
300
        ########################################
 
301
        ## END - generated method body
 
302
        
 
303
        return _dummyTrans and trans.response().getvalue() or ""
 
304
        
 
305
 
 
306
    def writeBody(self, **KWS):
 
307
 
 
308
 
 
309
 
 
310
        ## CHEETAH: main method generated for this template
 
311
        trans = KWS.get("trans")
 
312
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
 
313
            trans = self.transaction # is None unless self.awake() was called
 
314
        if not trans:
 
315
            trans = DummyTransaction()
 
316
            _dummyTrans = True
 
317
        else: _dummyTrans = False
 
318
        write = trans.response().write
 
319
        SL = self._CHEETAH__searchList
 
320
        _filter = self._CHEETAH__currentFilter
 
321
        
 
322
        ########################################
 
323
        ## START - generated method body
 
324
        
 
325
        write('\n\n')
 
326
        self.toplayout_content(trans=trans)
 
327
        
 
328
        ########################################
 
329
        ## END - generated method body
 
330
        
 
331
        return _dummyTrans and trans.response().getvalue() or ""
 
332
        
 
333
    ##################################################
 
334
    ## CHEETAH GENERATED ATTRIBUTES
 
335
 
 
336
 
 
337
    _CHEETAH__instanceInitialized = False
 
338
 
 
339
    _CHEETAH_version = __CHEETAH_version__
 
340
 
 
341
    _CHEETAH_versionTuple = __CHEETAH_versionTuple__
 
342
 
 
343
    _CHEETAH_genTime = __CHEETAH_genTime__
 
344
 
 
345
    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
 
346
 
 
347
    _CHEETAH_src = __CHEETAH_src__
 
348
 
 
349
    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
 
350
 
 
351
    _mainCheetahMethod_for_ClassicLayout= 'writeBody'
 
352
 
 
353
## END CLASS DEFINITION
 
354
 
 
355
if not hasattr(ClassicLayout, '_initCheetahAttributes'):
 
356
    templateAPIClass = getattr(ClassicLayout, '_CHEETAH_templateClass', Template)
 
357
    templateAPIClass._addCheetahPlumbingCodeToClass(ClassicLayout)
 
358
 
 
359
 
 
360
# CHEETAH was developed by Tavis Rudd and Mike Orr
 
361
# with code, advice and input from many other volunteers.
 
362
# For more information visit http://www.CheetahTemplate.org/
 
363
 
 
364
##################################################
 
365
## if run from command line:
 
366
if __name__ == '__main__':
 
367
    from Cheetah.TemplateCmdLineIface import CmdLineIface
 
368
    CmdLineIface(templateObj=ClassicLayout()).run()
 
369
 
 
370