]> git.phdru.name Git - m_librarian.git/blob - m_librarian/web/views/list_authors.py
Fix(web): Выровнять числа вправо
[m_librarian.git] / m_librarian / web / views / list_authors.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 import cgi
29 from m_librarian.translations import translations
30 from views.layout import layout
31 from views.search_authors_form import search_authors_form
32
33 ##################################################
34 ## MODULE CONSTANTS
35 VFFSL=valueFromFrameOrSearchList
36 VFSL=valueFromSearchList
37 VFN=valueForName
38 currentTime=time.time
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'
46
47 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
48     raise AssertionError(
49       'This template was compiled with Cheetah version'
50       ' %s. Templates compiled before version %s must be recompiled.'%(
51          __CHEETAH_version__, RequiredCheetahVersion))
52
53 ##################################################
54 ## CLASSES
55
56 class list_authors(layout):
57
58     ##################################################
59     ## CHEETAH GENERATED METHODS
60
61
62     def __init__(self, *args, **KWs):
63
64         super(list_authors, self).__init__(*args, **KWs)
65         if not self._CHEETAH__instanceInitialized:
66             cheetahKWArgs = {}
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)
71         
72
73     def body(self, **KWS):
74
75
76
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
81         if not trans:
82             trans = DummyTransaction()
83             _dummyTrans = True
84         else: _dummyTrans = False
85         write = trans.response().write
86         SL = self._CHEETAH__searchList
87         _filter = self._CHEETAH__currentFilter
88         
89         ########################################
90         ## START - generated method body
91         
92         write(u'''<h1>\u041f\u043e\u0438\u0441\u043a \u0430\u0432\u0442\u043e\u0440\u043e\u0432</h1>
93 ''')
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.
96         write(u'''
97
98 <h1>''')
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.
101         write(u'''</h1>
102
103 ''')
104         if VFFSL(SL,"authors",True): # generated from line 13, col 1
105             write(u'''  <table>
106   <tr>
107   ''')
108             if False:
109                 _
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">''')
113                 if False:
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.
117                 write(u'''</td>
118 ''')
119             write(u'''  </tr>
120 ''')
121             for author in VFFSL(SL,"authors",True): # generated from line 21, col 3
122                 write(u'''  <tr>
123 ''')
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
128                         style = ''
129                     write(u'''    <td''')
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.
135                     write(u'''/">
136     ''')
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.
139                     write(u'''
140     </a></td>
141 ''')
142                 write(u'''  </tr>
143 ''')
144             write(u'''  </table>
145 ''')
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>
148 ''')
149         
150         ########################################
151         ## END - generated method body
152         
153         return _dummyTrans and trans.response().getvalue() or ""
154         
155
156     def writeBody(self, **KWS):
157
158
159
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
164         if not trans:
165             trans = DummyTransaction()
166             _dummyTrans = True
167         else: _dummyTrans = False
168         write = trans.response().write
169         SL = self._CHEETAH__searchList
170         _filter = self._CHEETAH__currentFilter
171         
172         ########################################
173         ## START - generated method body
174         
175         
176         ########################################
177         ## END - generated method body
178         
179         return _dummyTrans and trans.response().getvalue() or ""
180         
181     ##################################################
182     ## CHEETAH GENERATED ATTRIBUTES
183
184
185     _CHEETAH__instanceInitialized = False
186
187     _CHEETAH_version = __CHEETAH_version__
188
189     _CHEETAH_versionTuple = __CHEETAH_versionTuple__
190
191     _CHEETAH_genTime = __CHEETAH_genTime__
192
193     _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
194
195     _CHEETAH_src = __CHEETAH_src__
196
197     _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
198
199     title = 'Список авторов'
200
201     _mainCheetahMethod_for_list_authors = 'writeBody'
202
203 ## END CLASS DEFINITION
204
205 if not hasattr(list_authors, '_initCheetahAttributes'):
206     templateAPIClass = getattr(list_authors,
207                                '_CHEETAH_templateClass',
208                                Template)
209     templateAPIClass._addCheetahPlumbingCodeToClass(list_authors)
210
211
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/
215
216 ##################################################
217 ## if run from command line:
218 if __name__ == '__main__':
219     from Cheetah.TemplateCmdLineIface import CmdLineIface
220     CmdLineIface(templateObj=list_authors()).run()
221
222