4 """A Skeleton HTML page template, that provides basic structure and utility methods.
8 ##################################################
13 from os
.path
import getmtime
, exists
17 from Cheetah
.Version
import MinCompatibleVersion
as RequiredCheetahVersion
18 from Cheetah
.Version
import MinCompatibleVersionTuple
as RequiredCheetahVersionTuple
19 from Cheetah
.Template
import Template
20 from Cheetah
.DummyTransaction
import DummyTransaction
21 from Cheetah
.NameMapper
import NotFound
, valueForName
, valueFromSearchList
, valueFromFrameOrSearchList
22 from Cheetah
.CacheRegion
import CacheRegion
23 import Cheetah
.Filters
as Filters
24 import Cheetah
.ErrorCatchers
as ErrorCatchers
25 from Cheetah
.Templates
._SkeletonPage
import _SkeletonPage
27 ##################################################
32 True, False = (1==1), (1==0)
33 VFFSL
=valueFromFrameOrSearchList
34 VFSL
=valueFromSearchList
37 __CHEETAH_version__
= '2.0rc6'
38 __CHEETAH_versionTuple__
= (2, 0, 0, 'candidate', 6)
39 __CHEETAH_genTime__
= 1139107954.3640411
40 __CHEETAH_genTimestamp__
= 'Sat Feb 4 18:52:34 2006'
41 __CHEETAH_src__
= 'src/Templates/SkeletonPage.tmpl'
42 __CHEETAH_srcLastModified__
= 'Mon Oct 7 11:37:30 2002'
43 __CHEETAH_docstring__
= 'Autogenerated by CHEETAH: The Python-Powered Template Engine'
45 if __CHEETAH_versionTuple__
< RequiredCheetahVersionTuple
:
47 'This template was compiled with Cheetah version'
48 ' %s. Templates compiled before version %s must be recompiled.'%(
49 __CHEETAH_version__
, RequiredCheetahVersion
))
51 ##################################################
54 class SkeletonPage(_SkeletonPage
):
56 ##################################################
57 ## CHEETAH GENERATED METHODS
60 def __init__(self
, *args
, **KWs
):
62 _SkeletonPage
.__init
__(self
, *args
, **KWs
)
63 if not self
._CHEETAH
__instanceInitialized
:
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
)
71 def writeHeadTag(self
, **KWS
):
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
80 trans
= DummyTransaction()
82 else: _dummyTrans
= False
83 write
= trans
.response().write
84 SL
= self
._CHEETAH
__searchList
85 _filter
= self
._CHEETAH
__currentFilter
87 ########################################
88 ## START - generated method body
90 write('<head>\n<title>')
91 _v
= VFFSL(SL
,"title",True) # '$title' on line 24, col 8
92 if _v
is not None: write(_filter(_v
, rawExpr
='$title')) # from line 24, col 8.
94 _v
= VFFSL(SL
,"metaTags",True) # '$metaTags' on line 25, col 1
95 if _v
is not None: write(_filter(_v
, rawExpr
='$metaTags')) # from line 25, col 1.
97 _v
= VFFSL(SL
,"stylesheetTags",True) # '$stylesheetTags' on line 26, col 1
98 if _v
is not None: write(_filter(_v
, rawExpr
='$stylesheetTags')) # from line 26, col 1.
100 _v
= VFFSL(SL
,"javascriptTags",True) # '$javascriptTags' on line 27, col 1
101 if _v
is not None: write(_filter(_v
, rawExpr
='$javascriptTags')) # from line 27, col 1.
104 ########################################
105 ## END - generated method body
107 return _dummyTrans
and trans
.response().getvalue() or ""
110 def writeBody(self
, **KWS
):
114 ## CHEETAH: generated from #block writeBody at line 36, col 1.
115 trans
= KWS
.get("trans")
116 if (not trans
and not self
._CHEETAH
__isBuffering
and not callable(self
.transaction
)):
117 trans
= self
.transaction
# is None unless self.awake() was called
119 trans
= DummyTransaction()
121 else: _dummyTrans
= False
122 write
= trans
.response().write
123 SL
= self
._CHEETAH
__searchList
124 _filter
= self
._CHEETAH
__currentFilter
126 ########################################
127 ## START - generated method body
129 write('This skeleton page has no flesh. Its body needs to be implemented.\n')
131 ########################################
132 ## END - generated method body
134 return _dummyTrans
and trans
.response().getvalue() or ""
137 def respond(self
, trans
=None):
141 ## CHEETAH: main method generated for this template
142 if (not trans
and not self
._CHEETAH
__isBuffering
and not callable(self
.transaction
)):
143 trans
= self
.transaction
# is None unless self.awake() was called
145 trans
= DummyTransaction()
147 else: _dummyTrans
= False
148 write
= trans
.response().write
149 SL
= self
._CHEETAH
__searchList
150 _filter
= self
._CHEETAH
__currentFilter
152 ########################################
153 ## START - generated method body
156 ## START CACHE REGION: ID=header. line 6, col 1 in the source.
157 _RECACHE_header
= False
158 _cacheRegion_header
= self
.getCacheRegion(regionID
='header', cacheInfo
={'type': 2, 'id': 'header'})
159 if _cacheRegion_header
.isNew():
160 _RECACHE_header
= True
161 _cacheItem_header
= _cacheRegion_header
.getCacheItem('header')
162 if _cacheItem_header
.hasExpired():
163 _RECACHE_header
= True
164 if (not _RECACHE_header
) and _cacheItem_header
.getRefreshTime():
166 _output
= _cacheItem_header
.renderOutput()
168 _RECACHE_header
= True
172 if _RECACHE_header
or not _cacheItem_header
.getRefreshTime():
173 _orig_transheader
= trans
174 trans
= _cacheCollector_header
= DummyTransaction()
175 write
= _cacheCollector_header
.response().write
176 _v
= VFFSL(SL
,"docType",True) # '$docType' on line 7, col 1
177 if _v
is not None: write(_filter(_v
, rawExpr
='$docType')) # from line 7, col 1.
179 _v
= VFFSL(SL
,"htmlTag",True) # '$htmlTag' on line 8, col 1
180 if _v
is not None: write(_filter(_v
, rawExpr
='$htmlTag')) # from line 8, col 1.
182 <!-- This document was autogenerated by Cheetah(http://CheetahTemplate.org).
183 Do not edit it directly!
186 _v
= VFFSL(SL
,"currentYr",True) # '$currentYr' on line 12, col 11
187 if _v
is not None: write(_filter(_v
, rawExpr
='$currentYr')) # from line 12, col 11.
189 _v
= VFFSL(SL
,"siteCopyrightName",True) # '$siteCopyrightName' on line 12, col 24
190 if _v
is not None: write(_filter(_v
, rawExpr
='$siteCopyrightName')) # from line 12, col 24.
191 write(' - All Rights Reserved.\nFeel free to copy any javascript or html you like on this site,\nprovided you remove all links and/or references to ')
192 _v
= VFFSL(SL
,"siteDomainName",True) # '$siteDomainName' on line 14, col 52
193 if _v
is not None: write(_filter(_v
, rawExpr
='$siteDomainName')) # from line 14, col 52.
195 However, please do not copy any content or images without permission.
198 _v
= VFFSL(SL
,"siteCredits",True) # '$siteCredits' on line 17, col 1
199 if _v
is not None: write(_filter(_v
, rawExpr
='$siteCredits')) # from line 17, col 1.
206 self
.writeHeadTag(trans
=trans
)
208 trans
= _orig_transheader
209 write
= trans
.response().write
210 _cacheData
= _cacheCollector_header
.response().getvalue()
211 _cacheItem_header
.setData(_cacheData
)
214 del _cacheCollector_header
215 del _orig_transheader
216 ## END CACHE REGION: header
219 _v
= VFFSL(SL
,"bodyTag",True) # '$bodyTag' on line 34, col 1
220 if _v
is not None: write(_filter(_v
, rawExpr
='$bodyTag')) # from line 34, col 1.
222 self
.writeBody(trans
=trans
)
231 ########################################
232 ## END - generated method body
234 return _dummyTrans
and trans
.response().getvalue() or ""
236 ##################################################
237 ## CHEETAH GENERATED ATTRIBUTES
240 _CHEETAH__instanceInitialized
= False
242 _CHEETAH_version
= __CHEETAH_version__
244 _CHEETAH_versionTuple
= __CHEETAH_versionTuple__
246 _CHEETAH_genTime
= __CHEETAH_genTime__
248 _CHEETAH_genTimestamp
= __CHEETAH_genTimestamp__
250 _CHEETAH_src
= __CHEETAH_src__
252 _CHEETAH_srcLastModified
= __CHEETAH_srcLastModified__
254 _mainCheetahMethod_for_SkeletonPage
= 'respond'
256 ## END CLASS DEFINITION
258 if not hasattr(SkeletonPage
, '_initCheetahAttributes'):
259 templateAPIClass
= getattr(SkeletonPage
, '_CHEETAH_templateClass', Template
)
260 templateAPIClass
._addCheetahPlumbingCodeToClass
(SkeletonPage
)
263 # CHEETAH was developed by Tavis Rudd and Mike Orr
264 # with code, advice and input from many other volunteers.
265 # For more information visit http://www.CheetahTemplate.org/
267 ##################################################
268 ## if run from command line:
269 if __name__
== '__main__':
270 from Cheetah
.TemplateCmdLineIface
import CmdLineIface
271 CmdLineIface(templateObj
=SkeletonPage()).run()