Debian Codegraph @

Cheetah/Templates/SkeletonPage.py

raw symbols SCIP
1 #!/usr/bin/env python
2
3
4 """A Skeleton HTML page template, that provides basic structure and utility methods.
5 """
6
7
8 ##################################################
9 ## DEPENDENCIES
10 import sys
11 import os
12 import os.path
13 try:
14 import builtins as builtin
15 except ImportError:
16 import __builtin__ as builtin
17 from os.path import getmtime, exists
18 import time
19 import types
20 from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
21 from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
22 from Cheetah.Template import Template
23 from Cheetah.DummyTransaction import *
24 from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
25 from Cheetah.CacheRegion import CacheRegion
26 import Cheetah.Filters as Filters
27 import Cheetah.ErrorCatchers as ErrorCatchers
28 from Cheetah.compat import unicode
29 from Cheetah.Templates._SkeletonPage import _SkeletonPage
30
31 ##################################################
32 ## MODULE CONSTANTS
33 VFFSL=valueFromFrameOrSearchList
34 VFSL=valueFromSearchList
35 VFN=valueForName
36 currentTime=time.time
37 __CHEETAH_version__ = '3.0.0'
38 __CHEETAH_versionTuple__ = (3, 0, 0, 'development', 1)
39 __CHEETAH_genTime__ = 1490043964.453685
40 __CHEETAH_genTimestamp__ = 'Tue Mar 21 00:06:04 2017'
41 __CHEETAH_src__ = 'Cheetah/Templates/SkeletonPage.tmpl'
42 __CHEETAH_srcLastModified__ = 'Tue Mar 14 23:26:16 2017'
43 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
44
45 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
46 raise AssertionError(
47 'This template was compiled with Cheetah version'
48 ' %s. Templates compiled before version %s must be recompiled.'%(
49 __CHEETAH_version__, RequiredCheetahVersion))
50
51 ##################################################
52 ## CLASSES
53
54 class SkeletonPage(_SkeletonPage):
55
56 ##################################################
57 ## CHEETAH GENERATED METHODS
58
59
60 def __init__(self, *args, **KWs):
61
62 super(SkeletonPage, self).__init__(*args, **KWs)
63 if not self._CHEETAH__instanceInitialized:
64 cheetahKWArgs = {}
65 allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
66 for k,v in KWs.items():
67 if k in allowedKWs: cheetahKWArgs[k] = v
68 self._initCheetahInstance(**cheetahKWArgs)
69
70
71 def writeHeadTag(self, **KWS):
72
73
74
75 ## CHEETAH: generated from #block writeHeadTag at line 22, col 1.
76 trans = KWS.get("trans")
77 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
78 trans = self.transaction # is None unless self.awake() was called
79 if not trans:
80 trans = DummyTransaction()
81 _dummyTrans = True
82 else: _dummyTrans = False
83 write = trans.response().write
84 SL = self._CHEETAH__searchList
85 _filter = self._CHEETAH__currentFilter
86
87 ########################################
88 ## START - generated method body
89
90 write(u'''<head>
91 <title>''')
92 _v = VFSL([locals()]+SL+[globals(), builtin],"title",True) # u'$title' on line 24, col 8
93 if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 24, col 8.
94 write(u'''</title>
95 ''')
96 _v = VFSL([locals()]+SL+[globals(), builtin],"metaTags",True) # u'$metaTags' on line 25, col 1
97 if _v is not None: write(_filter(_v, rawExpr=u'$metaTags')) # from line 25, col 1.
98 write(u'''
99 ''')
100 _v = VFSL([locals()]+SL+[globals(), builtin],"stylesheetTags",True) # u'$stylesheetTags' on line 26, col 1
101 if _v is not None: write(_filter(_v, rawExpr=u'$stylesheetTags')) # from line 26, col 1.
102 write(u'''
103 ''')
104 _v = VFSL([locals()]+SL+[globals(), builtin],"javascriptTags",True) # u'$javascriptTags' on line 27, col 1
105 if _v is not None: write(_filter(_v, rawExpr=u'$javascriptTags')) # from line 27, col 1.
106 write(u'''
107 </head>
108 ''')
109
110 ########################################
111 ## END - generated method body
112
113 return _dummyTrans and trans.response().getvalue() or ""
114
115
116 def writeBody(self, **KWS):
117
118
119
120 ## CHEETAH: generated from #block writeBody at line 36, col 1.
121 trans = KWS.get("trans")
122 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
123 trans = self.transaction # is None unless self.awake() was called
124 if not trans:
125 trans = DummyTransaction()
126 _dummyTrans = True
127 else: _dummyTrans = False
128 write = trans.response().write
129 SL = self._CHEETAH__searchList
130 _filter = self._CHEETAH__currentFilter
131
132 ########################################
133 ## START - generated method body
134
135 write(u'''This skeleton page has no flesh. Its body needs to be implemented.
136 ''')
137
138 ########################################
139 ## END - generated method body
140
141 return _dummyTrans and trans.response().getvalue() or ""
142
143
144 def respond(self, trans=None):
145
146
147
148 ## CHEETAH: main method generated for this template
149 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
150 trans = self.transaction # is None unless self.awake() was called
151 if not trans:
152 trans = DummyTransaction()
153 _dummyTrans = True
154 else: _dummyTrans = False
155 write = trans.response().write
156 SL = self._CHEETAH__searchList
157 _filter = self._CHEETAH__currentFilter
158
159 ########################################
160 ## START - generated method body
161
162
163 ## START CACHE REGION: ID=header. line 6, col 1 in the source.
164 _RECACHE_header = False
165 _cacheRegion_header = self.getCacheRegion(regionID=u'header', cacheInfo={'type': 2, u'id': u'header'})
166 if _cacheRegion_header.isNew():
167 _RECACHE_header = True
168 _cacheItem_header = _cacheRegion_header.getCacheItem(u'header')
169 if _cacheItem_header.hasExpired():
170 _RECACHE_header = True
171 if (not _RECACHE_header) and _cacheItem_header.getRefreshTime():
172 try:
173 _output = _cacheItem_header.renderOutput()
174 except KeyError:
175 _RECACHE_header = True
176 else:
177 write(_output)
178 del _output
179 if _RECACHE_header or not _cacheItem_header.getRefreshTime():
180 _orig_transheader = trans
181 trans = _cacheCollector_header = DummyTransaction()
182 write = _cacheCollector_header.response().write
183 _v = VFSL([locals()]+SL+[globals(), builtin],"docType",True) # u'$docType' on line 7, col 1
184 if _v is not None: write(_filter(_v, rawExpr=u'$docType')) # from line 7, col 1.
185 write(u'''
186 ''')
187 _v = VFSL([locals()]+SL+[globals(), builtin],"htmlTag",True) # u'$htmlTag' on line 8, col 1
188 if _v is not None: write(_filter(_v, rawExpr=u'$htmlTag')) # from line 8, col 1.
189 write(u'''
190 <!-- This document was autogenerated by Cheetah (https://cheetahtemplate.org/).
191 Do not edit it directly!
192
193 Copyright ''')
194 _v = VFSL([locals()]+SL+[globals(), builtin],"currentYr",True) # u'$currentYr' on line 12, col 11
195 if _v is not None: write(_filter(_v, rawExpr=u'$currentYr')) # from line 12, col 11.
196 write(u''' - ''')
197 _v = VFSL([locals()]+SL+[globals(), builtin],"siteCopyrightName",True) # u'$siteCopyrightName' on line 12, col 24
198 if _v is not None: write(_filter(_v, rawExpr=u'$siteCopyrightName')) # from line 12, col 24.
199 write(u''' - All Rights Reserved.
200 Feel free to copy any javascript or html you like on this site,
201 provided you remove all links and/or references to ''')
202 _v = VFSL([locals()]+SL+[globals(), builtin],"siteDomainName",True) # u'$siteDomainName' on line 14, col 52
203 if _v is not None: write(_filter(_v, rawExpr=u'$siteDomainName')) # from line 14, col 52.
204 write(u'''
205 However, please do not copy any content or images without permission.
206
207 ''')
208 _v = VFSL([locals()]+SL+[globals(), builtin],"siteCredits",True) # u'$siteCredits' on line 17, col 1
209 if _v is not None: write(_filter(_v, rawExpr=u'$siteCredits')) # from line 17, col 1.
210 write(u'''
211
212 -->
213
214
215 ''')
216 self.writeHeadTag(trans=trans)
217 write(u'''
218 ''')
219 trans = _orig_transheader
220 write = trans.response().write
221 _cacheData = _cacheCollector_header.response().getvalue()
222 _cacheItem_header.setData(_cacheData)
223 write(_cacheData)
224 del _cacheData
225 del _cacheCollector_header
226 del _orig_transheader
227 ## END CACHE REGION: header
228
229 write(u'''
230 ''')
231 _v = VFSL([locals()]+SL+[globals(), builtin],"bodyTag",True) # u'$bodyTag' on line 34, col 1
232 if _v is not None: write(_filter(_v, rawExpr=u'$bodyTag')) # from line 34, col 1.
233 write(u'''
234
235 ''')
236 self.writeBody(trans=trans)
237 write(u'''
238 </body>
239 </html>
240
241
242
243 ''')
244
245 ########################################
246 ## END - generated method body
247
248 return _dummyTrans and trans.response().getvalue() or ""
249
250 ##################################################
251 ## CHEETAH GENERATED ATTRIBUTES
252
253
254 _CHEETAH__instanceInitialized = False
255
256 _CHEETAH_version = __CHEETAH_version__
257
258 _CHEETAH_versionTuple = __CHEETAH_versionTuple__
259
260 _CHEETAH_genTime = __CHEETAH_genTime__
261
262 _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
263
264 _CHEETAH_src = __CHEETAH_src__
265
266 _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
267
268 _mainCheetahMethod_for_SkeletonPage= u'respond'
269
270 ## END CLASS DEFINITION
271
272 if not hasattr(SkeletonPage, '_initCheetahAttributes'):
273 templateAPIClass = getattr(SkeletonPage, '_CHEETAH_templateClass', Template)
274 templateAPIClass._addCheetahPlumbingCodeToClass(SkeletonPage)
275
276
277 # CHEETAH was developed by Tavis Rudd and Mike Orr
278 # with code, advice and input from many other volunteers.
279 # For more information visit https://cheetahtemplate.org/
280
281 ##################################################
282 ## if run from command line:
283 if __name__ == '__main__':
284 from Cheetah.TemplateCmdLineIface import CmdLineIface
285 CmdLineIface(templateObj=SkeletonPage()).run()