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 views.layout import layout
31 ##################################################
33 VFFSL=valueFromFrameOrSearchList
34 VFSL=valueFromSearchList
37 __CHEETAH_version__ = '3.1.0'
38 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
39 __CHEETAH_genTime__ = 1527367605.801202
40 __CHEETAH_genTimestamp__ = 'Sat May 26 23:46:45 2018'
41 __CHEETAH_src__ = 'list_books.tmpl'
42 __CHEETAH_srcLastModified__ = 'Sat May 26 23:46:44 2018'
43 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
45 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
47 'This template was compiled with Cheetah version'
48 ' %s. Templates compiled before version %s must be recompiled.'%(
49 __CHEETAH_version__, RequiredCheetahVersion))
51 ##################################################
54 class list_books(layout):
56 ##################################################
57 ## CHEETAH GENERATED METHODS
60 def __init__(self, *args, **KWs):
62 super(list_books, self).__init__(*args, **KWs)
63 if not self._CHEETAH__instanceInitialized:
65 allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
66 for k,v in KWs.items():
67 if k in allowedKWs: cheetahKWArgs[k] = v
68 self._initCheetahInstance(**cheetahKWArgs)
71 def body(self, **KWS):
75 ## CHEETAH: generated from #def body at line 5, col 1.
76 trans = KWS.get("trans")
77 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
78 trans = self.transaction # is None unless self.awake() was called
80 trans = DummyTransaction()
82 else: _dummyTrans = False
83 write = trans.response().write
84 SL = self._CHEETAH__searchList
85 _filter = self._CHEETAH__currentFilter
87 ########################################
88 ## START - generated method body
91 _v = VFFSL(SL,"title",True) # u'$title' on line 6, col 5
92 if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 6, col 5.
96 if VFFSL(SL,"books_by_author",True): # generated from line 8, col 1
97 write(u''' <form action="/download/" method="POST" style="height: 80%">
98 <div style="width: 100%; height: 90%">
99 <select multiple name="books" style="height: 100%">
102 for author in VFFSL(SL,"sorted",False)(VFFSL(SL,"books_by_author",True)): # generated from line 13, col 3
103 books = VFFSL(SL,"books_by_author",True)[VFFSL(SL,"author",True)]
104 for book in VFFSL(SL,"books",True): # generated from line 15, col 5
105 if VFFSL(SL,"book.series",True) != VFFSL(SL,"series",True): # generated from line 16, col 5
106 if VFFSL(SL,"series",True) is not None: # generated from line 17, col 5
107 write(u''' </optgroup>
109 series = VFFSL(SL,"book.series",True)
110 write(u''' <optgroup label="''')
111 _v = VFFSL(SL,"author",True) # u'$author' on line 22, col 1
112 if _v is not None: write(_filter(_v, rawExpr=u'$author')) # from line 22, col 1.
113 write(u''' \u2014 ''')
114 if VFFSL(SL,"book.series",True): # generated from line 23, col 5
115 _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(VFFSL(SL,"series",True), 1) # u'$cgi.escape($series, 1)' on line 24, col 1
116 if _v is not None: write(_filter(_v, rawExpr=u'$cgi.escape($series, 1)')) # from line 24, col 1.
117 else: # generated from line 25, col 5
118 write(u'''\u0412\u043d\u0435 \u0441\u0435\u0440\u0438\u0439''')
121 write(u''' <option value="''')
122 _v = VFFSL(SL,"book.id",True) # u'$book.id' on line 30, col 20
123 if _v is not None: write(_filter(_v, rawExpr=u'$book.id')) # from line 30, col 20.
125 _v = VFFSL(SL,"book.ser_no",True) # u'$book.ser_no' on line 30, col 30
126 if _v is not None: write(_filter(_v, rawExpr=u'$book.ser_no')) # from line 30, col 30.
128 _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(VFFSL(SL,"book.title",True)) # u'$cgi.escape($book.title)' on line 30, col 43
129 if _v is not None: write(_filter(_v, rawExpr=u'$cgi.escape($book.title)')) # from line 30, col 43.
132 write(u''' </optgroup>
135 <div style="width: 100%; text-align: center">
136 <input type="submit" value="\u0421\u043a\u0430\u0447\u0430\u0442\u044c">
140 else: # generated from line 40, col 1
141 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>
144 ########################################
145 ## END - generated method body
147 return _dummyTrans and trans.response().getvalue() or ""
150 def writeBody(self, **KWS):
154 ## CHEETAH: main method generated for this template
155 trans = KWS.get("trans")
156 if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
157 trans = self.transaction # is None unless self.awake() was called
159 trans = DummyTransaction()
161 else: _dummyTrans = False
162 write = trans.response().write
163 SL = self._CHEETAH__searchList
164 _filter = self._CHEETAH__currentFilter
166 ########################################
167 ## START - generated method body
170 ########################################
171 ## END - generated method body
173 return _dummyTrans and trans.response().getvalue() or ""
175 ##################################################
176 ## CHEETAH GENERATED ATTRIBUTES
179 _CHEETAH__instanceInitialized = False
181 _CHEETAH_version = __CHEETAH_version__
183 _CHEETAH_versionTuple = __CHEETAH_versionTuple__
185 _CHEETAH_genTime = __CHEETAH_genTime__
187 _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
189 _CHEETAH_src = __CHEETAH_src__
191 _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
193 title = 'Список книг'
195 _mainCheetahMethod_for_list_books = 'writeBody'
197 ## END CLASS DEFINITION
199 if not hasattr(list_books, '_initCheetahAttributes'):
200 templateAPIClass = getattr(list_books,
201 '_CHEETAH_templateClass',
203 templateAPIClass._addCheetahPlumbingCodeToClass(list_books)
206 # CHEETAH was developed by Tavis Rudd and Mike Orr
207 # with code, advice and input from many other volunteers.
208 # For more information visit http://cheetahtemplate.org/
210 ##################################################
211 ## if run from command line:
212 if __name__ == '__main__':
213 from Cheetah.TemplateCmdLineIface import CmdLineIface
214 CmdLineIface(templateObj=list_books()).run()