]> git.phdru.name Git - m_librarian.git/blob - m_librarian/web/views/list_authors.py
5c70204c7f390cbc60e2050012a34ca32f875588
[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 views.layout import layout
29 from views.search_authors_form import search_authors_form
30
31 ##################################################
32 ## MODULE CONSTANTS
33 VFFSL=valueFromFrameOrSearchList
34 VFSL=valueFromSearchList
35 VFN=valueForName
36 currentTime=time.time
37 __CHEETAH_version__ = '3.1.0'
38 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
39 __CHEETAH_genTime__ = 1523134510.111994
40 __CHEETAH_genTimestamp__ = 'Sat Apr  7 23:55:10 2018'
41 __CHEETAH_src__ = 'list_authors.tmpl'
42 __CHEETAH_srcLastModified__ = 'Sat Apr  7 23:55:07 2018'
43 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
44
45 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
46     raise AssertionError(
47       'This template was compiled with Cheetah version'
48       ' %s. Templates compiled before version %s must be recompiled.'%(
49          __CHEETAH_version__, RequiredCheetahVersion))
50
51 ##################################################
52 ## CLASSES
53
54 class list_authors(layout):
55
56     ##################################################
57     ## CHEETAH GENERATED METHODS
58
59
60     def __init__(self, *args, **KWs):
61
62         super(list_authors, self).__init__(*args, **KWs)
63         if not self._CHEETAH__instanceInitialized:
64             cheetahKWArgs = {}
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)
69         
70
71     def body(self, **KWS):
72
73
74
75         ## CHEETAH: generated from #def body at line 4, 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
79         if not trans:
80             trans = DummyTransaction()
81             _dummyTrans = True
82         else: _dummyTrans = False
83         write = trans.response().write
84         SL = self._CHEETAH__searchList
85         _filter = self._CHEETAH__currentFilter
86         
87         ########################################
88         ## START - generated method body
89         
90         write(u'''<h1>\u041f\u043e\u0438\u0441\u043a \u0430\u0432\u0442\u043e\u0440\u043e\u0432</h1>
91 ''')
92         _v = VFFSL(SL,"search_authors_form",False)(searchList=VFFSL(SL,"searchList",True)) # u'$search_authors_form(searchList=$searchList)' on line 7, col 1
93         if _v is not None: write(_filter(_v, rawExpr=u'$search_authors_form(searchList=$searchList)')) # from line 7, col 1.
94         write(u'''
95
96 <h1>''')
97         _v = VFFSL(SL,"title",True) # u'$title' on line 9, col 5
98         if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 9, col 5.
99         write(u'''</h1>
100
101 ''')
102         if VFFSL(SL,"authors",True): # generated from line 11, col 1
103             write(u'''  <table>
104 ''')
105             for author in VFFSL(SL,"authors",True): # generated from line 13, col 3
106                 write(u'''  <tr>
107     <td><a href="/books-by-author/''')
108                 _v = VFFSL(SL,"author.id",True) # u'$author.id' on line 15, col 35
109                 if _v is not None: write(_filter(_v, rawExpr=u'$author.id')) # from line 15, col 35.
110                 write(u'''/">''')
111                 _v = VFFSL(SL,"author.fullname",True) # u'$author.fullname' on line 15, col 48
112                 if _v is not None: write(_filter(_v, rawExpr=u'$author.fullname')) # from line 15, col 48.
113                 write(u'''</a></td>
114   </tr>
115 ''')
116             write(u'''  </table>
117 ''')
118         else: # generated from line 19, col 1
119             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>
120 ''')
121         
122         ########################################
123         ## END - generated method body
124         
125         return _dummyTrans and trans.response().getvalue() or ""
126         
127
128     def writeBody(self, **KWS):
129
130
131
132         ## CHEETAH: main method generated for this template
133         trans = KWS.get("trans")
134         if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
135             trans = self.transaction # is None unless self.awake() was called
136         if not trans:
137             trans = DummyTransaction()
138             _dummyTrans = True
139         else: _dummyTrans = False
140         write = trans.response().write
141         SL = self._CHEETAH__searchList
142         _filter = self._CHEETAH__currentFilter
143         
144         ########################################
145         ## START - generated method body
146         
147         
148         ########################################
149         ## END - generated method body
150         
151         return _dummyTrans and trans.response().getvalue() or ""
152         
153     ##################################################
154     ## CHEETAH GENERATED ATTRIBUTES
155
156
157     _CHEETAH__instanceInitialized = False
158
159     _CHEETAH_version = __CHEETAH_version__
160
161     _CHEETAH_versionTuple = __CHEETAH_versionTuple__
162
163     _CHEETAH_genTime = __CHEETAH_genTime__
164
165     _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
166
167     _CHEETAH_src = __CHEETAH_src__
168
169     _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
170
171     title = 'Список авторов'
172
173     _mainCheetahMethod_for_list_authors = 'writeBody'
174
175 ## END CLASS DEFINITION
176
177 if not hasattr(list_authors, '_initCheetahAttributes'):
178     templateAPIClass = getattr(list_authors,
179                                '_CHEETAH_templateClass',
180                                Template)
181     templateAPIClass._addCheetahPlumbingCodeToClass(list_authors)
182
183
184 # CHEETAH was developed by Tavis Rudd and Mike Orr
185 # with code, advice and input from many other volunteers.
186 # For more information visit http://cheetahtemplate.org/
187
188 ##################################################
189 ## if run from command line:
190 if __name__ == '__main__':
191     from Cheetah.TemplateCmdLineIface import CmdLineIface
192     CmdLineIface(templateObj=list_authors()).run()
193
194