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
29 from m_librarian.translations import translations
30 from views.layout import layout
31 from views.search_authors_form import search_authors_form
33 ##################################################
35 VFFSL=valueFromFrameOrSearchList
36 VFSL=valueFromSearchList
39 __CHEETAH_version__ = '3.1.0'
40 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
41 __CHEETAH_genTime__ = 1528718535.495412
42 __CHEETAH_genTimestamp__ = 'Mon Jun 11 15:02:15 2018'
43 __CHEETAH_src__ = 'list_authors.tmpl'
44 __CHEETAH_srcLastModified__ = 'Mon Jun 11 15:02:07 2018'
45 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
47 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
49 'This template was compiled with Cheetah version'
50 ' %s. Templates compiled before version %s must be recompiled.'%(
51 __CHEETAH_version__, RequiredCheetahVersion))
53 ##################################################
56 class list_authors(layout):
58 ##################################################
59 ## CHEETAH GENERATED METHODS
62 def __init__(self, *args, **KWs):
64 super(list_authors, self).__init__(*args, **KWs)
65 if not self._CHEETAH__instanceInitialized:
67 allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
68 for k,v in KWs.items():
69 if k in allowedKWs: cheetahKWArgs[k] = v
70 self._initCheetahInstance(**cheetahKWArgs)
73 def body(self, **KWS):
77 ## CHEETAH: generated from #def body at line 6, col 1.
78 trans = KWS.get("trans")
79 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
80 trans = self.transaction # is None unless self.awake() was called
82 trans = DummyTransaction()
84 else: _dummyTrans = False
85 write = trans.response().write
86 SL = self._CHEETAH__searchList
87 _filter = self._CHEETAH__currentFilter
89 ########################################
90 ## START - generated method body
92 write(u'''<h1>\u041f\u043e\u0438\u0441\u043a \u0430\u0432\u0442\u043e\u0440\u043e\u0432</h1>
94 _v = VFFSL(SL,"search_authors_form",False)(searchList=VFFSL(SL,"searchList",True)) # u'$search_authors_form(searchList=$searchList)' on line 9, col 1
95 if _v is not None: write(_filter(_v, rawExpr=u'$search_authors_form(searchList=$searchList)')) # from line 9, col 1.
99 _v = VFFSL(SL,"title",True) # u'$title' on line 11, col 5
100 if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 11, col 5.
104 if VFFSL(SL,"authors",True): # generated from line 13, col 1
110 _ = VFFSL(SL,"getattr",False)(VFFSL(SL,"translations",True), 'ugettext', None) or VFFSL(SL,"translations.gettext",True)
111 for column in VFFSL(SL,"columns",True): # generated from line 17, col 3
112 write(u''' <td style="text-align: center">''')
114 _(VFFSL(SL,"column",True))
115 _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(VFFSL(SL,"_",False)(VFFSL(SL,"column",True))) # u'$cgi.escape($_($column))' on line 18, col 36
116 if _v is not None: write(_filter(_v, rawExpr=u'$cgi.escape($_($column))')) # from line 18, col 36.
121 for author in VFFSL(SL,"authors",True): # generated from line 21, col 3
124 for column in VFFSL(SL,"columns",True): # generated from line 23, col 3
125 if VFFSL(SL,"column",True) == 'count': # generated from line 24, col 5
126 style = ' style="text-align: right; width: 5ex"'
127 else: # generated from line 26, col 5
130 _v = VFFSL(SL,"style",True) # u'$style' on line 29, col 8
131 if _v is not None: write(_filter(_v, rawExpr=u'$style')) # from line 29, col 8.
132 write(u'''><a href="/books-by-author/''')
133 _v = VFFSL(SL,"author.id",True) # u'$author.id' on line 29, col 41
134 if _v is not None: write(_filter(_v, rawExpr=u'$author.id')) # from line 29, col 41.
137 _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(unicode(VFFSL(SL,"getattr",False)(VFFSL(SL,"author",True), VFFSL(SL,"column",True)) or '')) # u"$cgi.escape(unicode($getattr($author, $column) or ''))" on line 30, col 5
138 if _v is not None: write(_filter(_v, rawExpr=u"$cgi.escape(unicode($getattr($author, $column) or ''))")) # from line 30, col 5.
146 else: # generated from line 36, col 1
147 write(u''' <p>\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0430\u0432\u0442\u043e\u0440\u0430!</p>
150 ########################################
151 ## END - generated method body
153 return _dummyTrans and trans.response().getvalue() or ""
156 def writeBody(self, **KWS):
160 ## CHEETAH: main method generated for this template
161 trans = KWS.get("trans")
162 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
163 trans = self.transaction # is None unless self.awake() was called
165 trans = DummyTransaction()
167 else: _dummyTrans = False
168 write = trans.response().write
169 SL = self._CHEETAH__searchList
170 _filter = self._CHEETAH__currentFilter
172 ########################################
173 ## START - generated method body
176 ########################################
177 ## END - generated method body
179 return _dummyTrans and trans.response().getvalue() or ""
181 ##################################################
182 ## CHEETAH GENERATED ATTRIBUTES
185 _CHEETAH__instanceInitialized = False
187 _CHEETAH_version = __CHEETAH_version__
189 _CHEETAH_versionTuple = __CHEETAH_versionTuple__
191 _CHEETAH_genTime = __CHEETAH_genTime__
193 _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
195 _CHEETAH_src = __CHEETAH_src__
197 _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
199 title = 'Список авторов'
201 _mainCheetahMethod_for_list_authors = 'writeBody'
203 ## END CLASS DEFINITION
205 if not hasattr(list_authors, '_initCheetahAttributes'):
206 templateAPIClass = getattr(list_authors,
207 '_CHEETAH_templateClass',
209 templateAPIClass._addCheetahPlumbingCodeToClass(list_authors)
212 # CHEETAH was developed by Tavis Rudd and Mike Orr
213 # with code, advice and input from many other volunteers.
214 # For more information visit http://cheetahtemplate.org/
216 ##################################################
217 ## if run from command line:
218 if __name__ == '__main__':
219 from Cheetah.TemplateCmdLineIface import CmdLineIface
220 CmdLineIface(templateObj=list_authors()).run()