]> git.phdru.name Git - m_librarian.git/blob - m_librarian/web/views/index.py
Feat(web): Use CheetahTemplate
[m_librarian.git] / m_librarian / web / views / index.py
1 #!/usr/bin/env python
2
3
4
5
6 ##################################################
7 ## DEPENDENCIES
8 import sys
9 import os
10 import os.path
11 try:
12     import builtins as builtin
13 except ImportError:
14     import __builtin__ as builtin
15 from os.path import getmtime, exists
16 import time
17 import types
18 from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
19 from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
20 from Cheetah.Template import Template
21 from Cheetah.DummyTransaction import *
22 from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
23 from Cheetah.CacheRegion import CacheRegion
24 import Cheetah.Filters as Filters
25 import Cheetah.ErrorCatchers as ErrorCatchers
26 from Cheetah.compat import unicode
27 from views.layout import layout
28
29 ##################################################
30 ## MODULE CONSTANTS
31 VFFSL=valueFromFrameOrSearchList
32 VFSL=valueFromSearchList
33 VFN=valueForName
34 currentTime=time.time
35 __CHEETAH_version__ = '3.1.0'
36 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
37 __CHEETAH_genTime__ = 1522609706.987582
38 __CHEETAH_genTimestamp__ = 'Sun Apr  1 22:08:26 2018'
39 __CHEETAH_src__ = 'index.tmpl'
40 __CHEETAH_srcLastModified__ = 'Sun Apr  1 22:08:25 2018'
41 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
42
43 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
44     raise AssertionError(
45       'This template was compiled with Cheetah version'
46       ' %s. Templates compiled before version %s must be recompiled.'%(
47          __CHEETAH_version__, RequiredCheetahVersion))
48
49 ##################################################
50 ## CLASSES
51
52 class index(layout):
53
54     ##################################################
55     ## CHEETAH GENERATED METHODS
56
57
58     def __init__(self, *args, **KWs):
59
60         super(index, self).__init__(*args, **KWs)
61         if not self._CHEETAH__instanceInitialized:
62             cheetahKWArgs = {}
63             allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
64             for k,v in KWs.items():
65                 if k in allowedKWs: cheetahKWArgs[k] = v
66             self._initCheetahInstance(**cheetahKWArgs)
67         
68
69     def body(self, **KWS):
70
71
72
73         ## CHEETAH: generated from #def body at line 3, col 1.
74         trans = KWS.get("trans")
75         if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
76             trans = self.transaction # is None unless self.awake() was called
77         if not trans:
78             trans = DummyTransaction()
79             _dummyTrans = True
80         else: _dummyTrans = False
81         write = trans.response().write
82         SL = self._CHEETAH__searchList
83         _filter = self._CHEETAH__currentFilter
84         
85         ########################################
86         ## START - generated method body
87         
88         write(u'''<h1>Index</h1>
89
90 <p>Hello, World!</p>
91
92 <p><a href="/quit">Quit</a></p>
93 ''')
94         
95         ########################################
96         ## END - generated method body
97         
98         return _dummyTrans and trans.response().getvalue() or ""
99         
100
101     def writeBody(self, **KWS):
102
103
104
105         ## CHEETAH: main method generated for this template
106         trans = KWS.get("trans")
107         if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
108             trans = self.transaction # is None unless self.awake() was called
109         if not trans:
110             trans = DummyTransaction()
111             _dummyTrans = True
112         else: _dummyTrans = False
113         write = trans.response().write
114         SL = self._CHEETAH__searchList
115         _filter = self._CHEETAH__currentFilter
116         
117         ########################################
118         ## START - generated method body
119         
120         
121         ########################################
122         ## END - generated method body
123         
124         return _dummyTrans and trans.response().getvalue() or ""
125         
126     ##################################################
127     ## CHEETAH GENERATED ATTRIBUTES
128
129
130     _CHEETAH__instanceInitialized = False
131
132     _CHEETAH_version = __CHEETAH_version__
133
134     _CHEETAH_versionTuple = __CHEETAH_versionTuple__
135
136     _CHEETAH_genTime = __CHEETAH_genTime__
137
138     _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
139
140     _CHEETAH_src = __CHEETAH_src__
141
142     _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
143
144     title = 'Index'
145
146     _mainCheetahMethod_for_index = 'writeBody'
147
148 ## END CLASS DEFINITION
149
150 if not hasattr(index, '_initCheetahAttributes'):
151     templateAPIClass = getattr(index,
152                                '_CHEETAH_templateClass',
153                                Template)
154     templateAPIClass._addCheetahPlumbingCodeToClass(index)
155
156
157 # CHEETAH was developed by Tavis Rudd and Mike Orr
158 # with code, advice and input from many other volunteers.
159 # For more information visit http://cheetahtemplate.org/
160
161 ##################################################
162 ## if run from command line:
163 if __name__ == '__main__':
164     from Cheetah.TemplateCmdLineIface import CmdLineIface
165     CmdLineIface(templateObj=index()).run()
166
167