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