]> git.phdru.name Git - m_librarian.git/blob - m_librarian/web/views/search_authors_form.py
Feat(web): Search authors
[m_librarian.git] / m_librarian / web / views / search_authors_form.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
29 ##################################################
30 ## MODULE CONSTANTS
31 VFFSL=valueFromFrameOrSearchList
32 VFSL=valueFromSearchList
33 VFN=valueForName
34 currentTime=time.time
35 __CHEETAH_version__ = '3.1.0'
36 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
37 __CHEETAH_genTime__ = 1522958937.217914
38 __CHEETAH_genTimestamp__ = 'Thu Apr  5 23:08:57 2018'
39 __CHEETAH_src__ = 'search_authors_form.tmpl'
40 __CHEETAH_srcLastModified__ = 'Thu Apr  5 23:08:55 2018'
41 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
42
43 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
44     raise AssertionError(
45       'This template was compiled with Cheetah version'
46       ' %s. Templates compiled before version %s must be recompiled.'%(
47          __CHEETAH_version__, RequiredCheetahVersion))
48
49 ##################################################
50 ## CLASSES
51
52 class search_authors_form(Template):
53
54     ##################################################
55     ## CHEETAH GENERATED METHODS
56
57
58     def __init__(self, *args, **KWs):
59
60         super(search_authors_form, self).__init__(*args, **KWs)
61         if not self._CHEETAH__instanceInitialized:
62             cheetahKWArgs = {}
63             allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
64             for k,v in KWs.items():
65                 if k in allowedKWs: cheetahKWArgs[k] = v
66             self._initCheetahInstance(**cheetahKWArgs)
67         
68
69     def respond(self, trans=None):
70
71
72
73         ## CHEETAH: main method generated for this template
74         if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
75             trans = self.transaction # is None unless self.awake() was called
76         if not trans:
77             trans = DummyTransaction()
78             _dummyTrans = True
79         else: _dummyTrans = False
80         write = trans.response().write
81         SL = self._CHEETAH__searchList
82         _filter = self._CHEETAH__currentFilter
83         
84         ########################################
85         ## START - generated method body
86         
87         write(u'''<form action="/search_authors/" method="POST">
88   <input name="search_authors" type="text" style="width: 80%">
89   <br>
90   <input name="search_type" value="start" type="radio">
91   \u041f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435
92   <input name="search_type" value="substring" type="radio">
93   \u041f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0430
94   <input name="search_type" value="full" type="radio">
95   \u0422\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435
96   <br>
97   <input name="case_sensitive" type="checkbox">
98   \u0420\u0430\u0437\u043b\u0438\u0447\u0430\u0442\u044c \u043f\u0440\u043e\u043f\u0438\u0441\u043d\u044b\u0435/\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0435
99   <br>
100   <input name="submit" type="submit">
101 </form>
102 ''')
103         
104         ########################################
105         ## END - generated method body
106         
107         return _dummyTrans and trans.response().getvalue() or ""
108         
109     ##################################################
110     ## CHEETAH GENERATED ATTRIBUTES
111
112
113     _CHEETAH__instanceInitialized = False
114
115     _CHEETAH_version = __CHEETAH_version__
116
117     _CHEETAH_versionTuple = __CHEETAH_versionTuple__
118
119     _CHEETAH_genTime = __CHEETAH_genTime__
120
121     _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
122
123     _CHEETAH_src = __CHEETAH_src__
124
125     _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
126
127     _mainCheetahMethod_for_search_authors_form = 'respond'
128
129 ## END CLASS DEFINITION
130
131 if not hasattr(search_authors_form, '_initCheetahAttributes'):
132     templateAPIClass = getattr(search_authors_form,
133                                '_CHEETAH_templateClass',
134                                Template)
135     templateAPIClass._addCheetahPlumbingCodeToClass(search_authors_form)
136
137
138 # CHEETAH was developed by Tavis Rudd and Mike Orr
139 # with code, advice and input from many other volunteers.
140 # For more information visit http://cheetahtemplate.org/
141
142 ##################################################
143 ## if run from command line:
144 if __name__ == '__main__':
145     from Cheetah.TemplateCmdLineIface import CmdLineIface
146     CmdLineIface(templateObj=search_authors_form()).run()
147
148