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
28 from views.layout import layout
30 ##################################################
32 VFFSL=valueFromFrameOrSearchList
33 VFSL=valueFromSearchList
36 __CHEETAH_version__ = '3.1.0'
37 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
38 __CHEETAH_genTime__ = 1527212249.002131
39 __CHEETAH_genTimestamp__ = 'Fri May 25 04:37:29 2018'
40 __CHEETAH_src__ = 'books_by_author.tmpl'
41 __CHEETAH_srcLastModified__ = 'Fri May 25 04:37:19 2018'
42 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
44 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
46 'This template was compiled with Cheetah version'
47 ' %s. Templates compiled before version %s must be recompiled.'%(
48 __CHEETAH_version__, RequiredCheetahVersion))
50 ##################################################
53 class books_by_author(layout):
55 ##################################################
56 ## CHEETAH GENERATED METHODS
59 def __init__(self, *args, **KWs):
61 super(books_by_author, self).__init__(*args, **KWs)
62 if not self._CHEETAH__instanceInitialized:
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)
70 def body(self, **KWS):
74 ## CHEETAH: generated from #def body at line 4, 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
79 trans = DummyTransaction()
81 else: _dummyTrans = False
82 write = trans.response().write
83 SL = self._CHEETAH__searchList
84 _filter = self._CHEETAH__currentFilter
86 ########################################
87 ## START - generated method body
90 _v = VFFSL(SL,"title",True) # u'$title' on line 5, col 5
91 if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 5, col 5.
93 _v = VFFSL(SL,"author.fullname",True) # u'$author.fullname' on line 5, col 12
94 if _v is not None: write(_filter(_v, rawExpr=u'$author.fullname')) # from line 5, col 12.
98 if VFFSL(SL,"books",True): # generated from line 7, col 1
99 write(u''' <form action="" method="POST" style="height: 80%">
100 <select multiple style="height: 90%">
103 for book in VFFSL(SL,"books",True): # generated from line 11, col 3
104 if VFFSL(SL,"book.series",True) != VFFSL(SL,"series",True): # generated from line 12, col 3
105 if VFFSL(SL,"series",True) is not None: # generated from line 13, col 3
106 write(u''' </optgroup>
108 series = VFFSL(SL,"book.series",True)
109 write(u''' <optgroup label="''')
110 if VFFSL(SL,"book.series",True): # generated from line 18, col 3
111 _v = VFFSL(SL,"series",True) # u'$series' on line 19, col 1
112 if _v is not None: write(_filter(_v, rawExpr=u'$series')) # from line 19, col 1.
113 else: # generated from line 20, col 3
114 write(u'''\u0412\u043d\u0435 \u0441\u0435\u0440\u0438\u0439''')
117 write(u''' <option value="''')
118 _v = VFFSL(SL,"book.id",True) # u'$book.id' on line 25, col 18
119 if _v is not None: write(_filter(_v, rawExpr=u'$book.id')) # from line 25, col 18.
121 _v = VFFSL(SL,"book.ser_no",True) # u'$book.ser_no' on line 25, col 28
122 if _v is not None: write(_filter(_v, rawExpr=u'$book.ser_no')) # from line 25, col 28.
124 _v = VFFSL(SL,"book.title",True) # u'$book.title' on line 25, col 41
125 if _v is not None: write(_filter(_v, rawExpr=u'$book.title')) # from line 25, col 41.
128 write(u''' </optgroup>
132 else: # generated from line 30, col 1
133 write(u''' <p>\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u043a\u043d\u0438\u0433\u0438!</p>
136 ########################################
137 ## END - generated method body
139 return _dummyTrans and trans.response().getvalue() or ""
142 def writeBody(self, **KWS):
146 ## CHEETAH: main method generated for this template
147 trans = KWS.get("trans")
148 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
149 trans = self.transaction # is None unless self.awake() was called
151 trans = DummyTransaction()
153 else: _dummyTrans = False
154 write = trans.response().write
155 SL = self._CHEETAH__searchList
156 _filter = self._CHEETAH__currentFilter
158 ########################################
159 ## START - generated method body
162 ########################################
163 ## END - generated method body
165 return _dummyTrans and trans.response().getvalue() or ""
167 ##################################################
168 ## CHEETAH GENERATED ATTRIBUTES
171 _CHEETAH__instanceInitialized = False
173 _CHEETAH_version = __CHEETAH_version__
175 _CHEETAH_versionTuple = __CHEETAH_versionTuple__
177 _CHEETAH_genTime = __CHEETAH_genTime__
179 _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
181 _CHEETAH_src = __CHEETAH_src__
183 _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
185 title = 'Список книг автора'
187 _mainCheetahMethod_for_books_by_author = 'writeBody'
189 ## END CLASS DEFINITION
191 if not hasattr(books_by_author, '_initCheetahAttributes'):
192 templateAPIClass = getattr(books_by_author,
193 '_CHEETAH_templateClass',
195 templateAPIClass._addCheetahPlumbingCodeToClass(books_by_author)
198 # CHEETAH was developed by Tavis Rudd and Mike Orr
199 # with code, advice and input from many other volunteers.
200 # For more information visit http://cheetahtemplate.org/
202 ##################################################
203 ## if run from command line:
204 if __name__ == '__main__':
205 from Cheetah.TemplateCmdLineIface import CmdLineIface
206 CmdLineIface(templateObj=books_by_author()).run()