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__ = 1528717961.404398
42 __CHEETAH_genTimestamp__ = 'Mon Jun 11 14:52:41 2018'
43 __CHEETAH_src__ = 'list_authors.tmpl'
44 __CHEETAH_srcLastModified__ = 'Mon Jun 11 14:52:34 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 write(u''' <td><a href="/books-by-author/''')
126 _v = VFFSL(SL,"author.id",True) # u'$author.id' on line 24, col 35
127 if _v is not None: write(_filter(_v, rawExpr=u'$author.id')) # from line 24, col 35.
130 _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 25, col 5
131 if _v is not None: write(_filter(_v, rawExpr=u"$cgi.escape(unicode($getattr($author, $column) or ''))")) # from line 25, col 5.
139 else: # generated from line 31, col 1
140 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>
143 ########################################
144 ## END - generated method body
146 return _dummyTrans and trans.response().getvalue() or ""
149 def writeBody(self, **KWS):
153 ## CHEETAH: main method generated for this template
154 trans = KWS.get("trans")
155 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
156 trans = self.transaction # is None unless self.awake() was called
158 trans = DummyTransaction()
160 else: _dummyTrans = False
161 write = trans.response().write
162 SL = self._CHEETAH__searchList
163 _filter = self._CHEETAH__currentFilter
165 ########################################
166 ## START - generated method body
169 ########################################
170 ## END - generated method body
172 return _dummyTrans and trans.response().getvalue() or ""
174 ##################################################
175 ## CHEETAH GENERATED ATTRIBUTES
178 _CHEETAH__instanceInitialized = False
180 _CHEETAH_version = __CHEETAH_version__
182 _CHEETAH_versionTuple = __CHEETAH_versionTuple__
184 _CHEETAH_genTime = __CHEETAH_genTime__
186 _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
188 _CHEETAH_src = __CHEETAH_src__
190 _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
192 title = 'Список авторов'
194 _mainCheetahMethod_for_list_authors = 'writeBody'
196 ## END CLASS DEFINITION
198 if not hasattr(list_authors, '_initCheetahAttributes'):
199 templateAPIClass = getattr(list_authors,
200 '_CHEETAH_templateClass',
202 templateAPIClass._addCheetahPlumbingCodeToClass(list_authors)
205 # CHEETAH was developed by Tavis Rudd and Mike Orr
206 # with code, advice and input from many other volunteers.
207 # For more information visit http://cheetahtemplate.org/
209 ##################################################
210 ## if run from command line:
211 if __name__ == '__main__':
212 from Cheetah.TemplateCmdLineIface import CmdLineIface
213 CmdLineIface(templateObj=list_authors()).run()