6 ##################################################
11 from os.path import getmtime, exists
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
24 ##################################################
29 True, False = (1==1), (1==0)
30 VFFSL=valueFromFrameOrSearchList
31 VFSL=valueFromSearchList
34 __CHEETAH_version__ = '2.0rc8'
35 __CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 8)
36 __CHEETAH_genTime__ = 1192883107.2568331
37 __CHEETAH_genTimestamp__ = 'Sat Oct 20 08:25:07 2007'
38 __CHEETAH_src__ = 'functions.tmpl'
39 __CHEETAH_srcLastModified__ = 'Sat Oct 20 07:34:59 2007'
40 __CHEETAH_docstring__ = 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
42 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
44 'This template was compiled with Cheetah version'
45 ' %s. Templates compiled before version %s must be recompiled.'%(
46 __CHEETAH_version__, RequiredCheetahVersion))
48 ##################################################
51 class functions(Template):
53 ##################################################
54 ## CHEETAH GENERATED METHODS
57 def __init__(self, *args, **KWs):
59 Template.__init__(self, *args, **KWs)
60 if not self._CHEETAH__instanceInitialized:
62 allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
63 for k,v in KWs.items():
64 if k in allowedKWs: cheetahKWArgs[k] = v
65 self._initCheetahInstance(**cheetahKWArgs)
68 def cdromList(self, cdroms, default="", **KWS):
72 ## CHEETAH: generated from #def cdromList($cdroms, $default="") at line 1, col 1.
73 trans = KWS.get("trans")
74 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
75 trans = self.transaction # is None unless self.awake() was called
77 trans = DummyTransaction()
79 else: _dummyTrans = False
80 write = trans.response().write
81 SL = self._CHEETAH__searchList
82 _filter = self._CHEETAH__currentFilter
84 ########################################
85 ## START - generated method body
87 write('''<select name="cdrom">
89 if VFFSL(SL,"default",True) : # generated from line 4, col 1
91 if _v is not None: write(_filter(_v))
94 if _v is not None: write(_filter(_v))
95 write(''' value="">None</option>
97 for cdrom in VFFSL(SL,"cdroms",True): # generated from line 6, col 3
98 write(''' <option ''')
99 if VFFSL(SL,"default",True) == VFFSL(SL,"cdrom.cdrom_id",True) : # generated from line 8, col 1
101 if _v is not None: write(_filter(_v))
104 if _v is not None: write(_filter(_v))
105 write(''' value="''')
106 _v = VFFSL(SL,"cdrom.cdrom_id",True) # '$cdrom.cdrom_id' on line 9, col 9
107 if _v is not None: write(_filter(_v, rawExpr='$cdrom.cdrom_id')) # from line 9, col 9.
110 _v = VFFSL(SL,"cdrom.description",True) # '$cdrom.description' on line 10, col 5
111 if _v is not None: write(_filter(_v, rawExpr='$cdrom.description')) # from line 10, col 5.
118 ########################################
119 ## END - generated method body
121 return _dummyTrans and trans.response().getvalue() or ""
124 def addError(self, txt, **KWS):
128 ## CHEETAH: generated from #def addError(txt) at line 16, 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
133 trans = DummyTransaction()
135 else: _dummyTrans = False
136 write = trans.response().write
137 SL = self._CHEETAH__searchList
138 _filter = self._CHEETAH__currentFilter
140 ########################################
141 ## START - generated method body
143 if VFFSL(SL,"varExists",False)('txt'): # generated from line 17, col 1
144 self._CHEETAH__globalSetVars["error_text"] = VFFSL(SL,"error_text",True) + '----\n' + VFFSL(SL,"txt",True)
145 else: # generated from line 19, col 1
146 self._CHEETAH__globalSetVars["error_text"] = VFFSL(SL,"txt",True)
148 ########################################
149 ## END - generated method body
151 return _dummyTrans and trans.response().getvalue() or ""
154 def errorRow(self, value, err, **KWS):
158 ## CHEETAH: generated from #def errorRow($value, $err) at line 24, col 1.
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
163 trans = DummyTransaction()
165 else: _dummyTrans = False
166 write = trans.response().write
167 SL = self._CHEETAH__searchList
168 _filter = self._CHEETAH__currentFilter
170 ########################################
171 ## START - generated method body
173 if VFFSL(SL,"err",True) and VFFSL(SL,"err.err_field",True) == VFFSL(SL,"value",True): # generated from line 25, col 1
175 <td class="error" colspan="2">''')
176 _v = VFFSL(SL,"str",False)(VFFSL(SL,"err",True)) # '${str($err)}' on line 27, col 31
177 if _v is not None: write(_filter(_v, rawExpr='${str($err)}')) # from line 27, col 31.
182 ########################################
183 ## END - generated method body
185 return _dummyTrans and trans.response().getvalue() or ""
188 def respond(self, trans=None):
192 ## CHEETAH: main method generated for this template
193 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
194 trans = self.transaction # is None unless self.awake() was called
196 trans = DummyTransaction()
198 else: _dummyTrans = False
199 write = trans.response().write
200 SL = self._CHEETAH__searchList
201 _filter = self._CHEETAH__currentFilter
203 ########################################
204 ## START - generated method body
210 _v = VFFSL(SL,"full_body",True) # '$full_body' on line 32, col 1
211 if _v is not None: write(_filter(_v, rawExpr='$full_body')) # from line 32, col 1.
213 ########################################
214 ## END - generated method body
216 return _dummyTrans and trans.response().getvalue() or ""
218 ##################################################
219 ## CHEETAH GENERATED ATTRIBUTES
222 _CHEETAH__instanceInitialized = False
224 _CHEETAH_version = __CHEETAH_version__
226 _CHEETAH_versionTuple = __CHEETAH_versionTuple__
228 _CHEETAH_genTime = __CHEETAH_genTime__
230 _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
232 _CHEETAH_src = __CHEETAH_src__
234 _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
236 _mainCheetahMethod_for_functions= 'respond'
238 ## END CLASS DEFINITION
240 if not hasattr(functions, '_initCheetahAttributes'):
241 templateAPIClass = getattr(functions, '_CHEETAH_templateClass', Template)
242 templateAPIClass._addCheetahPlumbingCodeToClass(functions)
245 # CHEETAH was developed by Tavis Rudd and Mike Orr
246 # with code, advice and input from many other volunteers.
247 # For more information visit http://www.CheetahTemplate.org/
249 ##################################################
250 ## if run from command line:
251 if __name__ == '__main__':
252 from Cheetah.TemplateCmdLineIface import CmdLineIface
253 CmdLineIface(templateObj=functions()).run()