~ubuntu-branches/ubuntu/gutsy/prewikka/gutsy

« back to all changes in this revision

Viewing changes to prewikka/templates/MessageDetails.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.ClassicLayout import ClassicLayout
 
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__ = 1166283668.986696
 
38
__CHEETAH_genTimestamp__ = 'Sat Dec 16 16:41:08 2006'
 
39
__CHEETAH_src__ = 'prewikka/templates/MessageDetails.tmpl'
 
40
__CHEETAH_srcLastModified__ = 'Fri Dec 15 10:49:19 2006'
 
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 MessageDetails(ClassicLayout):
 
53
 
 
54
    ##################################################
 
55
    ## CHEETAH GENERATED METHODS
 
56
 
 
57
 
 
58
    def __init__(self, *args, **KWs):
 
59
 
 
60
        ClassicLayout.__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 display_node(self, node, **KWS):
 
70
 
 
71
 
 
72
 
 
73
        ## CHEETAH: generated from #def display_node($node) at line 4, 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
        display = ("block", "none")[VFFSL(SL,"node.hidden",True)]
 
89
        write('<div class="message_details">\n\t<div class="message_details_title"><a href="#" onclick="javascript:toggleVisibility(\'section_')
 
90
        _v = VFFSL(SL,"node.id",True) # '$node.id' on line 7, col 95
 
91
        if _v is not None: write(_filter(_v, rawExpr='$node.id')) # from line 7, col 95.
 
92
        write('\'); return false;">')
 
93
        _v = VFFSL(SL,"node.name",True) # '$node.name' on line 7, col 122
 
94
        if _v is not None: write(_filter(_v, rawExpr='$node.name')) # from line 7, col 122.
 
95
        write('</a></div>\n\t<div class="message_details_content" id="section_')
 
96
        _v = VFFSL(SL,"node.id",True) # '$node.id' on line 8, col 51
 
97
        if _v is not None: write(_filter(_v, rawExpr='$node.id')) # from line 8, col 51.
 
98
        write('" style="display: ')
 
99
        _v = VFFSL(SL,"display",True) # '$display' on line 8, col 77
 
100
        if _v is not None: write(_filter(_v, rawExpr='$display')) # from line 8, col 77.
 
101
        write('">\n')
 
102
        for entry in VFFSL(SL,"node.entries",True): # generated from line 9, col 3
 
103
            if isinstance(VFFSL(SL,"entry.value",True), dict): # generated from line 10, col 4
 
104
                write('\t\t\t\t')
 
105
                _v = VFFSL(SL,"display_node",False)(VFFSL(SL,"entry.value",True)) # '$display_node($entry.value)' on line 11, col 5
 
106
                if _v is not None: write(_filter(_v, rawExpr='$display_node($entry.value)')) # from line 11, col 5.
 
107
                write('\n')
 
108
            else: # generated from line 12, col 4
 
109
                write('\t\t\t\t<div class="message_details_entry">\n\t\t\t\t\t<div class="message_details_entry_name">')
 
110
                _v = VFFSL(SL,"entry.name",True) # '$entry.name' on line 14, col 46
 
111
                if _v is not None: write(_filter(_v, rawExpr='$entry.name')) # from line 14, col 46.
 
112
                write('</div>\n\t\t\t\t\t<div class="message_details_entry_value">')
 
113
                _v = VFFSL(SL,"entry.value",True) # '$entry.value' on line 15, col 47
 
114
                if _v is not None: write(_filter(_v, rawExpr='$entry.value')) # from line 15, col 47.
 
115
                write('</div>\n\t\t\t\t</div>\n')
 
116
        write('\t</div>\n</div>\n')
 
117
        
 
118
        ########################################
 
119
        ## END - generated method body
 
120
        
 
121
        return _dummyTrans and trans.response().getvalue() or ""
 
122
        
 
123
 
 
124
    def main_content(self, **KWS):
 
125
 
 
126
 
 
127
 
 
128
        ## CHEETAH: generated from #block main_content at line 3, col 1.
 
129
        trans = KWS.get("trans")
 
130
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
 
131
            trans = self.transaction # is None unless self.awake() was called
 
132
        if not trans:
 
133
            trans = DummyTransaction()
 
134
            _dummyTrans = True
 
135
        else: _dummyTrans = False
 
136
        write = trans.response().write
 
137
        SL = self._CHEETAH__searchList
 
138
        _filter = self._CHEETAH__currentFilter
 
139
        
 
140
        ########################################
 
141
        ## START - generated method body
 
142
        
 
143
        write('\n')
 
144
        _v = VFFSL(SL,"display_node",False)(VFFSL(SL,"node",True)) # '$display_node($node)' on line 23, col 1
 
145
        if _v is not None: write(_filter(_v, rawExpr='$display_node($node)')) # from line 23, col 1.
 
146
        write('\n\n')
 
147
        
 
148
        ########################################
 
149
        ## END - generated method body
 
150
        
 
151
        return _dummyTrans and trans.response().getvalue() or ""
 
152
        
 
153
 
 
154
    def writeBody(self, **KWS):
 
155
 
 
156
 
 
157
 
 
158
        ## CHEETAH: main method generated for this template
 
159
        trans = KWS.get("trans")
 
160
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
 
161
            trans = self.transaction # is None unless self.awake() was called
 
162
        if not trans:
 
163
            trans = DummyTransaction()
 
164
            _dummyTrans = True
 
165
        else: _dummyTrans = False
 
166
        write = trans.response().write
 
167
        SL = self._CHEETAH__searchList
 
168
        _filter = self._CHEETAH__currentFilter
 
169
        
 
170
        ########################################
 
171
        ## START - generated method body
 
172
        
 
173
        write('\n')
 
174
        self.main_content(trans=trans)
 
175
        
 
176
        ########################################
 
177
        ## END - generated method body
 
178
        
 
179
        return _dummyTrans and trans.response().getvalue() or ""
 
180
        
 
181
    ##################################################
 
182
    ## CHEETAH GENERATED ATTRIBUTES
 
183
 
 
184
 
 
185
    _CHEETAH__instanceInitialized = False
 
186
 
 
187
    _CHEETAH_version = __CHEETAH_version__
 
188
 
 
189
    _CHEETAH_versionTuple = __CHEETAH_versionTuple__
 
190
 
 
191
    _CHEETAH_genTime = __CHEETAH_genTime__
 
192
 
 
193
    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
 
194
 
 
195
    _CHEETAH_src = __CHEETAH_src__
 
196
 
 
197
    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
 
198
 
 
199
    _mainCheetahMethod_for_MessageDetails= 'writeBody'
 
200
 
 
201
## END CLASS DEFINITION
 
202
 
 
203
if not hasattr(MessageDetails, '_initCheetahAttributes'):
 
204
    templateAPIClass = getattr(MessageDetails, '_CHEETAH_templateClass', Template)
 
205
    templateAPIClass._addCheetahPlumbingCodeToClass(MessageDetails)
 
206
 
 
207
 
 
208
# CHEETAH was developed by Tavis Rudd and Mike Orr
 
209
# with code, advice and input from many other volunteers.
 
210
# For more information visit http://www.CheetahTemplate.org/
 
211
 
 
212
##################################################
 
213
## if run from command line:
 
214
if __name__ == '__main__':
 
215
    from Cheetah.TemplateCmdLineIface import CmdLineIface
 
216
    CmdLineIface(templateObj=MessageDetails()).run()
 
217
 
 
218