2 # -*- coding: utf-8 -*-
7 ##################################################
13 import builtins as builtin
15 import __builtin__ as builtin
16 from os.path import getmtime, exists
19 from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
20 from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
21 from Cheetah.Template import Template
22 from Cheetah.DummyTransaction import *
23 from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
24 from Cheetah.CacheRegion import CacheRegion
25 import Cheetah.Filters as Filters
26 import Cheetah.ErrorCatchers as ErrorCatchers
27 from Cheetah.compat import unicode
28 from views.layout import layout
30 ##################################################
32 VFFSL=valueFromFrameOrSearchList
33 VFSL=valueFromSearchList
36 __CHEETAH_version__ = '3.3.1'
37 __CHEETAH_versionTuple__ = (3, 3, 1, 'final', 0)
38 __CHEETAH_genTime__ = 1704845598.39619
39 __CHEETAH_genTimestamp__ = 'Wed Jan 10 03:13:18 2024'
40 __CHEETAH_src__ = 'download.tmpl'
41 __CHEETAH_srcLastModified__ = 'Wed Jan 10 03:10:53 2024'
42 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
44 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
46 'This template was compiled with Cheetah version'
47 ' %s. Templates compiled before version %s must be recompiled.'%(
48 __CHEETAH_version__, RequiredCheetahVersion))
50 ##################################################
53 class download(layout):
55 ##################################################
56 ## CHEETAH GENERATED METHODS
59 def __init__(self, *args, **KWs):
61 super(download, self).__init__(*args, **KWs)
62 if not self._CHEETAH__instanceInitialized:
64 allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
65 for k,v in KWs.items():
66 if k in allowedKWs: cheetahKWArgs[k] = v
67 self._initCheetahInstance(**cheetahKWArgs)
70 def body(self, **KWS):
74 ## CHEETAH: generated from #def body at line 4, col 1.
75 trans = KWS.get("trans")
76 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
77 trans = self.transaction # is None unless self.awake() was called
79 trans = DummyTransaction()
81 else: _dummyTrans = False
82 write = trans.response().write
83 SL = self._CHEETAH__searchList
84 _filter = self._CHEETAH__currentFilter
86 ########################################
87 ## START - generated method body
90 _v = VFFSL(SL,"title",True) # u'$title' on line 5, col 5
91 if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 5, col 5.
95 if VFFSL(SL,"getVar",False)('error', None): # generated from line 7, col 1
96 write(u'''<p style="color: red">''')
97 _v = VFFSL(SL,"error",True) # u'$error' on line 8, col 23
98 if _v is not None: write(_filter(_v, rawExpr=u'$error')) # from line 8, col 23.
101 else: # generated from line 9, col 1
103 _v = VFFSL(SL,"message",True) # u'$message' on line 10, col 4
104 if _v is not None: write(_filter(_v, rawExpr=u'$message')) # from line 10, col 4.
108 ########################################
109 ## END - generated method body
111 return _dummyTrans and trans.response().getvalue() or ""
114 def writeBody(self, **KWS):
118 ## CHEETAH: main method generated for this template
119 trans = KWS.get("trans")
120 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
121 trans = self.transaction # is None unless self.awake() was called
123 trans = DummyTransaction()
125 else: _dummyTrans = False
126 write = trans.response().write
127 SL = self._CHEETAH__searchList
128 _filter = self._CHEETAH__currentFilter
130 ########################################
131 ## START - generated method body
134 ########################################
135 ## END - generated method body
137 return _dummyTrans and trans.response().getvalue() or ""
139 ##################################################
140 ## CHEETAH GENERATED ATTRIBUTES
143 _CHEETAH__instanceInitialized = False
145 _CHEETAH_version = __CHEETAH_version__
147 _CHEETAH_versionTuple = __CHEETAH_versionTuple__
149 _CHEETAH_genTime = __CHEETAH_genTime__
151 _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
153 _CHEETAH_src = __CHEETAH_src__
155 _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
159 _mainCheetahMethod_for_download = 'writeBody'
161 ## END CLASS DEFINITION
163 if not hasattr(download, '_initCheetahAttributes'):
164 templateAPIClass = getattr(download,
165 '_CHEETAH_templateClass',
167 templateAPIClass._addCheetahPlumbingCodeToClass(download)
170 # CHEETAH was developed by Tavis Rudd and Mike Orr
171 # with code, advice and input from many other volunteers.
172 # For more information visit https://cheetahtemplate.org/
174 ##################################################
175 ## if run from command line:
176 if __name__ == '__main__':
177 from Cheetah.TemplateCmdLineIface import CmdLineIface
178 CmdLineIface(templateObj=download()).run()