]> git.phdru.name Git - m_librarian.git/blob - m_librarian/web/views/list_authors.py
Feat(web): Search authors
[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
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__ = 1522957487.491209
39 __CHEETAH_genTimestamp__ = 'Thu Apr  5 22:44:47 2018'
40 __CHEETAH_src__ = 'list_authors.tmpl'
41 __CHEETAH_srcLastModified__ = 'Thu Apr  5 22:42:57 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 list_authors(layout):
54
55     ##################################################
56     ## CHEETAH GENERATED METHODS
57
58
59     def __init__(self, *args, **KWs):
60
61         super(list_authors, 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'''</h1>
93
94 ''')
95         if VFFSL(SL,"authors",True): # generated from line 7, col 1
96             write(u'''  <table>
97 ''')
98             for author in VFFSL(SL,"authors",True): # generated from line 9, col 3
99                 write(u'''  <tr>
100     <td>''')
101                 _v = VFFSL(SL,"author.fullname",True) # u'$author.fullname' on line 11, col 9
102                 if _v is not None: write(_filter(_v, rawExpr=u'$author.fullname')) # from line 11, col 9.
103                 write(u'''</td>
104   </tr>
105 ''')
106             write(u'''  </table>
107 ''')
108         else: # generated from line 15, col 1
109             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>
110 ''')
111         
112         ########################################
113         ## END - generated method body
114         
115         return _dummyTrans and trans.response().getvalue() or ""
116         
117
118     def writeBody(self, **KWS):
119
120
121
122         ## CHEETAH: main method generated for this template
123         trans = KWS.get("trans")
124         if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
125             trans = self.transaction # is None unless self.awake() was called
126         if not trans:
127             trans = DummyTransaction()
128             _dummyTrans = True
129         else: _dummyTrans = False
130         write = trans.response().write
131         SL = self._CHEETAH__searchList
132         _filter = self._CHEETAH__currentFilter
133         
134         ########################################
135         ## START - generated method body
136         
137         
138         ########################################
139         ## END - generated method body
140         
141         return _dummyTrans and trans.response().getvalue() or ""
142         
143     ##################################################
144     ## CHEETAH GENERATED ATTRIBUTES
145
146
147     _CHEETAH__instanceInitialized = False
148
149     _CHEETAH_version = __CHEETAH_version__
150
151     _CHEETAH_versionTuple = __CHEETAH_versionTuple__
152
153     _CHEETAH_genTime = __CHEETAH_genTime__
154
155     _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
156
157     _CHEETAH_src = __CHEETAH_src__
158
159     _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
160
161     title = 'Список авторов'
162
163     _mainCheetahMethod_for_list_authors = 'writeBody'
164
165 ## END CLASS DEFINITION
166
167 if not hasattr(list_authors, '_initCheetahAttributes'):
168     templateAPIClass = getattr(list_authors,
169                                '_CHEETAH_templateClass',
170                                Template)
171     templateAPIClass._addCheetahPlumbingCodeToClass(list_authors)
172
173
174 # CHEETAH was developed by Tavis Rudd and Mike Orr
175 # with code, advice and input from many other volunteers.
176 # For more information visit http://cheetahtemplate.org/
177
178 ##################################################
179 ## if run from command line:
180 if __name__ == '__main__':
181     from Cheetah.TemplateCmdLineIface import CmdLineIface
182     CmdLineIface(templateObj=list_authors()).run()
183
184