]> git.phdru.name Git - m_librarian.git/blob - m_librarian/web/views/list_authors.py
Docs(TODO): These items are for wxPython
[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 from m_librarian.translations import translations
29 from views.layout import layout
30 from views.search_authors_form import search_authors_form
31
32 ##################################################
33 ## MODULE CONSTANTS
34 VFFSL=valueFromFrameOrSearchList
35 VFSL=valueFromSearchList
36 VFN=valueForName
37 currentTime=time.time
38 __CHEETAH_version__ = '3.3.1'
39 __CHEETAH_versionTuple__ = (3, 3, 1, 'final', 0)
40 __CHEETAH_genTime__ = 1718725815.054143
41 __CHEETAH_genTimestamp__ = 'Tue Jun 18 18:50:15 2024'
42 __CHEETAH_src__ = 'list_authors.tmpl'
43 __CHEETAH_srcLastModified__ = 'Tue Jun 18 18:50:12 2024'
44 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
45
46 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
47     raise AssertionError(
48       'This template was compiled with Cheetah version'
49       ' %s. Templates compiled before version %s must be recompiled.'%(
50          __CHEETAH_version__, RequiredCheetahVersion))
51
52 ##################################################
53 ## CLASSES
54
55 class list_authors(layout):
56
57     ##################################################
58     ## CHEETAH GENERATED METHODS
59
60
61     def __init__(self, *args, **KWs):
62
63         super(list_authors, self).__init__(*args, **KWs)
64         if not self._CHEETAH__instanceInitialized:
65             cheetahKWArgs = {}
66             allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
67             for k,v in KWs.items():
68                 if k in allowedKWs: cheetahKWArgs[k] = v
69             self._initCheetahInstance(**cheetahKWArgs)
70         
71
72     def body(self, **KWS):
73
74
75
76         ## CHEETAH: generated from #def body at line 5, col 1.
77         trans = KWS.get("trans")
78         if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
79             trans = self.transaction # is None unless self.awake() was called
80         if not trans:
81             trans = DummyTransaction()
82             _dummyTrans = True
83         else: _dummyTrans = False
84         write = trans.response().write
85         SL = self._CHEETAH__searchList
86         _filter = self._CHEETAH__currentFilter
87         
88         ########################################
89         ## START - generated method body
90         
91         write(u'''<h1>\u041f\u043e\u0438\u0441\u043a \u0430\u0432\u0442\u043e\u0440\u043e\u0432</h1>
92 ''')
93         _v = VFFSL(SL,"search_authors_form",False)(searchList=VFFSL(SL,"searchList",True)) # u'$search_authors_form(searchList=$searchList)' on line 8, col 1
94         if _v is not None: write(_filter(_v, rawExpr=u'$search_authors_form(searchList=$searchList)')) # from line 8, col 1.
95         write(u'''
96
97 <h1>''')
98         _v = VFFSL(SL,"title",True) # u'$title' on line 10, col 5
99         if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 10, col 5.
100         write(u'''</h1>
101
102 ''')
103         if VFFSL(SL,"authors",True): # generated from line 12, col 1
104             _orig_filter_63533534 = _filter
105             filterName = u'WebSafe'
106             if "WebSafe" in self._CHEETAH__filters:
107                 _filter = self._CHEETAH__currentFilter = self._CHEETAH__filters[filterName]
108             else:
109                 _filter = self._CHEETAH__currentFilter = \
110                         self._CHEETAH__filters[filterName] = getattr(self._CHEETAH__filtersLib, filterName)(self).filter
111             write(u'''  <table>
112   <tr>
113   ''')
114             if False:
115                 _
116             _ = VFFSL(SL,"getattr",False)(VFFSL(SL,"translations",True), 'ugettext', None) or VFFSL(SL,"translations.gettext",True)
117             for column in VFFSL(SL,"columns",True): # generated from line 17, col 3
118                 write(u'''    <td style="text-align: center">''')
119                 if False:
120                     _(VFFSL(SL,"column",True))
121                 _v = VFFSL(SL,"_",False)(VFFSL(SL,"column",True)) # u'$_($column)' on line 18, col 36
122                 if _v is not None: write(_filter(_v, rawExpr=u'$_($column)')) # from line 18, col 36.
123                 write(u'''</td>
124 ''')
125             write(u'''  </tr>
126 ''')
127             for author in VFFSL(SL,"authors",True): # generated from line 21, col 3
128                 write(u'''  <tr>
129 ''')
130                 for column in VFFSL(SL,"columns",True): # generated from line 23, col 3
131                     if VFFSL(SL,"column",True) == 'count': # generated from line 24, col 5
132                         style = ' style="text-align: right; width: 5ex"'
133                     else: # generated from line 26, col 5
134                         style = ''
135                     write(u'''    <td''')
136                     _v = VFFSL(SL,"style",True) # u'$style' on line 29, col 8
137                     if _v is not None: write(_filter(_v, rawExpr=u'$style')) # from line 29, col 8.
138                     write(u'''><a href="/books-by-author/''')
139                     _v = VFFSL(SL,"author.id",True) # u'$author.id' on line 29, col 41
140                     if _v is not None: write(_filter(_v, rawExpr=u'$author.id')) # from line 29, col 41.
141                     write(u'''/">
142     ''')
143                     _v = VFFSL(SL,"unicode",False)(VFFSL(SL,"getattr",False)(VFFSL(SL,"author",True), VFFSL(SL,"column",True)) or '') # u"$unicode($getattr($author, $column) or '')" on line 30, col 5
144                     if _v is not None: write(_filter(_v, rawExpr=u"$unicode($getattr($author, $column) or '')")) # from line 30, col 5.
145                     write(u'''
146     </a></td>
147 ''')
148                 write(u'''  </tr>
149 ''')
150             write(u'''  </table>
151 ''')
152             _filter = self._CHEETAH__currentFilter = _orig_filter_63533534
153         else: # generated from line 37, col 1
154             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>
155 ''')
156         
157         ########################################
158         ## END - generated method body
159         
160         return _dummyTrans and trans.response().getvalue() or ""
161         
162
163     def writeBody(self, **KWS):
164
165
166
167         ## CHEETAH: main method generated for this template
168         trans = KWS.get("trans")
169         if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
170             trans = self.transaction # is None unless self.awake() was called
171         if not trans:
172             trans = DummyTransaction()
173             _dummyTrans = True
174         else: _dummyTrans = False
175         write = trans.response().write
176         SL = self._CHEETAH__searchList
177         _filter = self._CHEETAH__currentFilter
178         
179         ########################################
180         ## START - generated method body
181         
182         
183         ########################################
184         ## END - generated method body
185         
186         return _dummyTrans and trans.response().getvalue() or ""
187         
188     ##################################################
189     ## CHEETAH GENERATED ATTRIBUTES
190
191
192     _CHEETAH__instanceInitialized = False
193
194     _CHEETAH_version = __CHEETAH_version__
195
196     _CHEETAH_versionTuple = __CHEETAH_versionTuple__
197
198     _CHEETAH_genTime = __CHEETAH_genTime__
199
200     _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
201
202     _CHEETAH_src = __CHEETAH_src__
203
204     _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
205
206     title = 'Список авторов'
207
208     _mainCheetahMethod_for_list_authors = 'writeBody'
209
210 ## END CLASS DEFINITION
211
212 if not hasattr(list_authors, '_initCheetahAttributes'):
213     templateAPIClass = getattr(list_authors,
214                                '_CHEETAH_templateClass',
215                                Template)
216     templateAPIClass._addCheetahPlumbingCodeToClass(list_authors)
217
218
219 # CHEETAH was developed by Tavis Rudd and Mike Orr
220 # with code, advice and input from many other volunteers.
221 # For more information visit https://cheetahtemplate.org/
222
223 ##################################################
224 ## if run from command line:
225 if __name__ == '__main__':
226     from Cheetah.TemplateCmdLineIface import CmdLineIface
227     CmdLineIface(templateObj=list_authors()).run()
228
229