]> git.phdru.name Git - m_librarian.git/blob - m_librarian/web/views/books_by_author.py
ebb1cc6fd969a8a626ccbd381fae43a012a3fed2
[m_librarian.git] / m_librarian / web / views / books_by_author.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4
5
6
7 ##################################################
8 ## DEPENDENCIES
9 import sys
10 import os
11 import os.path
12 try:
13     import builtins as builtin
14 except ImportError:
15     import __builtin__ as builtin
16 from os.path import getmtime, exists
17 import time
18 import types
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
29
30 ##################################################
31 ## MODULE CONSTANTS
32 VFFSL=valueFromFrameOrSearchList
33 VFSL=valueFromSearchList
34 VFN=valueForName
35 currentTime=time.time
36 __CHEETAH_version__ = '3.1.0'
37 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
38 __CHEETAH_genTime__ = 1523142213.339173
39 __CHEETAH_genTimestamp__ = 'Sun Apr  8 02:03:33 2018'
40 __CHEETAH_src__ = 'books_by_author.tmpl'
41 __CHEETAH_srcLastModified__ = 'Sun Apr  8 02:03:31 2018'
42 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
43
44 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
45     raise AssertionError(
46       'This template was compiled with Cheetah version'
47       ' %s. Templates compiled before version %s must be recompiled.'%(
48          __CHEETAH_version__, RequiredCheetahVersion))
49
50 ##################################################
51 ## CLASSES
52
53 class books_by_author(layout):
54
55     ##################################################
56     ## CHEETAH GENERATED METHODS
57
58
59     def __init__(self, *args, **KWs):
60
61         super(books_by_author, self).__init__(*args, **KWs)
62         if not self._CHEETAH__instanceInitialized:
63             cheetahKWArgs = {}
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)
68         
69
70     def body(self, **KWS):
71
72
73
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
78         if not trans:
79             trans = DummyTransaction()
80             _dummyTrans = True
81         else: _dummyTrans = False
82         write = trans.response().write
83         SL = self._CHEETAH__searchList
84         _filter = self._CHEETAH__currentFilter
85         
86         ########################################
87         ## START - generated method body
88         
89         write(u'''<h1>''')
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.
92         write(u''' ''')
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.
95         write(u'''</h1>
96
97 ''')
98         if VFFSL(SL,"books",True): # generated from line 7, col 1
99             write(u'''  <table>
100 ''')
101             series = None
102             for book in VFFSL(SL,"books",True): # generated from line 10, col 3
103                 if VFFSL(SL,"book.series",True) != VFFSL(SL,"series",True): # generated from line 11, col 3
104                     series = VFFSL(SL,"book.series",True)
105                     if VFFSL(SL,"book.series",True): # generated from line 13, col 3
106                         write(u'''  <tr>
107     <td colspan=2>\u0421\u0435\u0440\u0438\u044f: ''')
108                         _v = VFFSL(SL,"series",True) # u'$series' on line 15, col 26
109                         if _v is not None: write(_filter(_v, rawExpr=u'$series')) # from line 15, col 26.
110                         write(u'''</td>
111   </tr>
112 ''')
113                     else: # generated from line 17, col 3
114                         write(u'''  <tr>
115     <td colspan=2>\u0412\u043d\u0435 \u0441\u0435\u0440\u0438\u0439</td>
116   </tr>
117 ''')
118                 write(u'''  <tr>
119     <td class="numeric">''')
120                 _v = VFFSL(SL,"book.ser_no",True) # u'$book.ser_no' on line 24, col 25
121                 if _v is not None: write(_filter(_v, rawExpr=u'$book.ser_no')) # from line 24, col 25.
122                 write(u'''</td>
123     <td><a href="/download/''')
124                 _v = VFFSL(SL,"book.id",True) # u'$book.id' on line 25, col 28
125                 if _v is not None: write(_filter(_v, rawExpr=u'$book.id')) # from line 25, col 28.
126                 write(u'''/">''')
127                 _v = VFFSL(SL,"book.title",True) # u'$book.title' on line 25, col 39
128                 if _v is not None: write(_filter(_v, rawExpr=u'$book.title')) # from line 25, col 39.
129                 write(u'''</a></td>
130   </tr>
131 ''')
132             write(u'''  </table>
133 ''')
134         else: # generated from line 29, col 1
135             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         
138         ########################################
139         ## END - generated method body
140         
141         return _dummyTrans and trans.response().getvalue() or ""
142         
143
144     def writeBody(self, **KWS):
145
146
147
148         ## CHEETAH: main method generated for this template
149         trans = KWS.get("trans")
150         if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
151             trans = self.transaction # is None unless self.awake() was called
152         if not trans:
153             trans = DummyTransaction()
154             _dummyTrans = True
155         else: _dummyTrans = False
156         write = trans.response().write
157         SL = self._CHEETAH__searchList
158         _filter = self._CHEETAH__currentFilter
159         
160         ########################################
161         ## START - generated method body
162         
163         
164         ########################################
165         ## END - generated method body
166         
167         return _dummyTrans and trans.response().getvalue() or ""
168         
169     ##################################################
170     ## CHEETAH GENERATED ATTRIBUTES
171
172
173     _CHEETAH__instanceInitialized = False
174
175     _CHEETAH_version = __CHEETAH_version__
176
177     _CHEETAH_versionTuple = __CHEETAH_versionTuple__
178
179     _CHEETAH_genTime = __CHEETAH_genTime__
180
181     _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
182
183     _CHEETAH_src = __CHEETAH_src__
184
185     _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
186
187     title = 'Список книг автора'
188
189     _mainCheetahMethod_for_books_by_author = 'writeBody'
190
191 ## END CLASS DEFINITION
192
193 if not hasattr(books_by_author, '_initCheetahAttributes'):
194     templateAPIClass = getattr(books_by_author,
195                                '_CHEETAH_templateClass',
196                                Template)
197     templateAPIClass._addCheetahPlumbingCodeToClass(books_by_author)
198
199
200 # CHEETAH was developed by Tavis Rudd and Mike Orr
201 # with code, advice and input from many other volunteers.
202 # For more information visit http://cheetahtemplate.org/
203
204 ##################################################
205 ## if run from command line:
206 if __name__ == '__main__':
207     from Cheetah.TemplateCmdLineIface import CmdLineIface
208     CmdLineIface(templateObj=books_by_author()).run()
209
210