source: trunk/web/templates/functions.py @ 207

Last change on this file since 207 was 207, checked in by ecprice, 17 years ago

Removed the Javascript, since I realized that

  • The way it was was worthless
  • The architecture has serious trouble supporting useful js
File size: 8.6 KB
Line 
1#!/usr/bin/env python
2
3
4
5
6##################################################
7## DEPENDENCIES
8import sys
9import os
10import os.path
11from os.path import getmtime, exists
12import time
13import types
14import __builtin__
15from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
16from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
17from Cheetah.Template import Template
18from Cheetah.DummyTransaction import DummyTransaction
19from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
20from Cheetah.CacheRegion import CacheRegion
21import Cheetah.Filters as Filters
22import Cheetah.ErrorCatchers as ErrorCatchers
23
24##################################################
25## MODULE CONSTANTS
26try:
27    True, False
28except NameError:
29    True, False = (1==1), (1==0)
30VFFSL=valueFromFrameOrSearchList
31VFSL=valueFromSearchList
32VFN=valueForName
33currentTime=time.time
34__CHEETAH_version__ = '2.0rc8'
35__CHEETAH_versionTuple__ = (2, 0, 0, 'candidate', 8)
36__CHEETAH_genTime__ = 1192889324.134064
37__CHEETAH_genTimestamp__ = 'Sat Oct 20 10:08:44 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'
41
42if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
43    raise AssertionError(
44      'This template was compiled with Cheetah version'
45      ' %s. Templates compiled before version %s must be recompiled.'%(
46         __CHEETAH_version__, RequiredCheetahVersion))
47
48##################################################
49## CLASSES
50
51class functions(Template):
52
53    ##################################################
54    ## CHEETAH GENERATED METHODS
55
56
57    def __init__(self, *args, **KWs):
58
59        Template.__init__(self, *args, **KWs)
60        if not self._CHEETAH__instanceInitialized:
61            cheetahKWArgs = {}
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)
66       
67
68    def cdromList(self, cdroms, default="", **KWS):
69
70
71
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
76        if not trans:
77            trans = DummyTransaction()
78            _dummyTrans = True
79        else: _dummyTrans = False
80        write = trans.response().write
81        SL = self._CHEETAH__searchList
82        _filter = self._CHEETAH__currentFilter
83       
84        ########################################
85        ## START - generated method body
86       
87        write('''<select name="cdrom">
88  <option ''')
89        if VFFSL(SL,"default",True) : # generated from line 4, col 1
90            _v =  '' 
91            if _v is not None: write(_filter(_v))
92        else:
93            _v =  'selected'
94            if _v is not None: write(_filter(_v))
95        write(''' value="">None</option>
96''')
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
100                _v =  'selected' 
101                if _v is not None: write(_filter(_v))
102            else:
103                _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.
108            write('''">
109    ''')
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.
112            write('''
113  </option>
114''')
115        write('''</select>
116''')
117       
118        ########################################
119        ## END - generated method body
120       
121        return _dummyTrans and trans.response().getvalue() or ""
122       
123
124    def addError(self, txt, **KWS):
125
126
127
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
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        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)
147       
148        ########################################
149        ## END - generated method body
150       
151        return _dummyTrans and trans.response().getvalue() or ""
152       
153
154    def errorRow(self, value, err, **KWS):
155
156
157
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
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        if VFFSL(SL,"err",True) and VFFSL(SL,"err.err_field",True) == VFFSL(SL,"value",True): # generated from line 25, col 1
174            write('''<tr>
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.
178            write('''</td>
179</tr>
180''')
181       
182        ########################################
183        ## END - generated method body
184       
185        return _dummyTrans and trans.response().getvalue() or ""
186       
187
188    def respond(self, trans=None):
189
190
191
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
195        if not trans:
196            trans = DummyTransaction()
197            _dummyTrans = True
198        else: _dummyTrans = False
199        write = trans.response().write
200        SL = self._CHEETAH__searchList
201        _filter = self._CHEETAH__currentFilter
202       
203        ########################################
204        ## START - generated method body
205       
206        write('''
207
208
209''')
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.
212       
213        ########################################
214        ## END - generated method body
215       
216        return _dummyTrans and trans.response().getvalue() or ""
217       
218    ##################################################
219    ## CHEETAH GENERATED ATTRIBUTES
220
221
222    _CHEETAH__instanceInitialized = False
223
224    _CHEETAH_version = __CHEETAH_version__
225
226    _CHEETAH_versionTuple = __CHEETAH_versionTuple__
227
228    _CHEETAH_genTime = __CHEETAH_genTime__
229
230    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
231
232    _CHEETAH_src = __CHEETAH_src__
233
234    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
235
236    _mainCheetahMethod_for_functions= 'respond'
237
238## END CLASS DEFINITION
239
240if not hasattr(functions, '_initCheetahAttributes'):
241    templateAPIClass = getattr(functions, '_CHEETAH_templateClass', Template)
242    templateAPIClass._addCheetahPlumbingCodeToClass(functions)
243
244
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/
248
249##################################################
250## if run from command line:
251if __name__ == '__main__':
252    from Cheetah.TemplateCmdLineIface import CmdLineIface
253    CmdLineIface(templateObj=functions()).run()
254
255
Note: See TracBrowser for help on using the repository browser.