root/galaxy-central/eggs/Cheetah-2.2.2-py2.6-macosx-10.6-universal-ucs2.egg/Cheetah/Templates/SkeletonPage.py

リビジョン 3, 9.8 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

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