]> git.phdru.name Git - m_librarian.git/commitdiff
Feat(web): Search authors
authorOleg Broytman <phd@phdru.name>
Thu, 5 Apr 2018 20:19:16 +0000 (23:19 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 5 Apr 2018 20:19:16 +0000 (23:19 +0300)
m_librarian/web/app.py
m_librarian/web/views/index.py
m_librarian/web/views/index.tmpl
m_librarian/web/views/layout.py
m_librarian/web/views/layout.tmpl
m_librarian/web/views/list_authors.py [new file with mode: 0644]
m_librarian/web/views/list_authors.tmpl [new file with mode: 0644]
m_librarian/web/views/search_authors.py [new file with mode: 0644]
m_librarian/web/views/search_authors.tmpl [new file with mode: 0644]
m_librarian/web/views/search_authors_form.py [new file with mode: 0644]
m_librarian/web/views/search_authors_form.tmpl [new file with mode: 0644]

index 3a95c8bd701c67716d9423a8fb90a58405f7027c..e4677d317f10e7b6cb9204766b30500c2ba7b51e 100644 (file)
@@ -1,7 +1,55 @@
-from bottle import route, cheetah_view
+from sqlobject.sqlbuilder import CONCAT
+from bottle import cheetah_view, redirect, request, route
+
+from m_librarian.db import Author, open_db
+from m_librarian.search import search_authors
 
 
 @route('/')
 @cheetah_view('index.tmpl')
 def index():
     return {}
+
+
+@route('/search_authors', method='GET')
+def _search_authors():
+    return redirect('/search_authors/')
+
+
+@route('/search_authors/', method='GET')
+@cheetah_view('search_authors.tmpl')
+def search_authors_get():
+    return {}
+
+
+def decode(value):
+    if isinstance(value, bytes):
+        return value.decode('utf-8')
+    return value
+
+
+def _guess_case_sensitivity(value):
+    return not value.islower()
+
+
+@route('/search_authors/', method='POST')
+@cheetah_view('list_authors.tmpl')
+def search_authors_post():
+    value = request.forms.get('search_authors')
+    if not value:
+        return redirect('/search_authors/')
+    value = decode(value)
+    search_type = request.forms.get('search_type')
+    if not search_type:
+        search_type = 'start'
+    case_sensitive = request.forms.get('case_sensitive')
+    if case_sensitive is None:
+        case_sensitive = _guess_case_sensitivity(value)
+    expressions = [(
+        CONCAT(Author.q.surname, ' ', Author.q.name, ' ', Author.q.misc_name),
+        decode(value)
+    )]
+    open_db()
+    authors = search_authors(search_type, case_sensitive, {}, expressions,
+                             orderBy=('surname', 'name', 'misc_name'))
+    return {'authors': list(authors)}
index 9456a5e35ef23c8f8d01c2eabe1e253a5fe1417b..1e4c4dfab5355e963beecf790c5df0c45e26b565 100644 (file)
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 
 
 
@@ -25,6 +26,7 @@ import Cheetah.Filters as Filters
 import Cheetah.ErrorCatchers as ErrorCatchers
 from Cheetah.compat import unicode
 from views.layout import layout
+from views.search_authors_form import search_authors_form
 
 ##################################################
 ## MODULE CONSTANTS
@@ -34,10 +36,10 @@ VFN=valueForName
 currentTime=time.time
 __CHEETAH_version__ = '3.1.0'
 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
-__CHEETAH_genTime__ = 1522609706.987582
-__CHEETAH_genTimestamp__ = 'Sun Apr  1 22:08:26 2018'
+__CHEETAH_genTime__ = 1522958547.022135
+__CHEETAH_genTimestamp__ = 'Thu Apr  5 23:02:27 2018'
 __CHEETAH_src__ = 'index.tmpl'
-__CHEETAH_srcLastModified__ = 'Sun Apr  1 22:08:25 2018'
+__CHEETAH_srcLastModified__ = 'Thu Apr  5 23:02:23 2018'
 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
 
 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
@@ -70,7 +72,7 @@ class index(layout):
 
 
 
-        ## CHEETAH: generated from #def body at line 3, col 1.
+        ## CHEETAH: generated from #def body at line 4, col 1.
         trans = KWS.get("trans")
         if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
             trans = self.transaction # is None unless self.awake() was called
@@ -85,11 +87,12 @@ class index(layout):
         ########################################
         ## START - generated method body
         
-        write(u'''<h1>Index</h1>
+        write(u'''<h1>\u041f\u043e\u0438\u0441\u043a \u0430\u0432\u0442\u043e\u0440\u043e\u0432</h1>
 
-<p>Hello, World!</p>
-
-<p><a href="/quit">Quit</a></p>
+''')
+        _v = VFFSL(SL,"search_authors_form",False)() # u'$search_authors_form()' on line 8, col 1
+        if _v is not None: write(_filter(_v, rawExpr=u'$search_authors_form()')) # from line 8, col 1.
+        write(u'''
 ''')
         
         ########################################
@@ -141,7 +144,7 @@ class index(layout):
 
     _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
 
-    title = 'Index'
+    title = 'Поиск'
 
     _mainCheetahMethod_for_index = 'writeBody'
 
index 9832186812d628189bec49f712a7cf65cb49b863..57c6b74f81a116bc4c5b457b7588035fad06a466 100644 (file)
@@ -1,9 +1,9 @@
+#encoding utf-8
 #extends views.layout
-#attr $title = 'Index'
+#attr $title = 'Поиск'
 #def body
-<h1>Index</h1>
+<h1>Поиск авторов</h1>
 
-<p>Hello, World!</p>
-
-<p><a href="/quit">Quit</a></p>
+#from views.search_authors_form import search_authors_form
+$search_authors_form()
 #end def
index f8ba1b2e7d1608fa2c89c503767574aae531b240..726e57028a4a62de8e22470814fa4e61beecfd78 100644 (file)
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 
 
 
@@ -33,10 +34,10 @@ VFN=valueForName
 currentTime=time.time
 __CHEETAH_version__ = '3.1.0'
 __CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
-__CHEETAH_genTime__ = 1522609587.049776
-__CHEETAH_genTimestamp__ = 'Sun Apr  1 22:06:27 2018'
+__CHEETAH_genTime__ = 1522953148.995817
+__CHEETAH_genTimestamp__ = 'Thu Apr  5 21:32:28 2018'
 __CHEETAH_src__ = 'layout.tmpl'
-__CHEETAH_srcLastModified__ = 'Sun Apr  1 22:06:06 2018'
+__CHEETAH_srcLastModified__ = 'Thu Apr  5 21:32:27 2018'
 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
 
 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
@@ -88,22 +89,28 @@ class layout(Template):
 <html>
 <!-- THIS PAGE IS AUTOMATICALLY GENERATED USING CheetahTemplate. DO NOT EDIT. -->
 <head>
-<meta HTTP-Equiv="Content-Type" content="text/html">
+<meta HTTP-Equiv="Content-Type" content="text/html; charset=utf-8">
 <title>''')
-        _v = VFFSL(SL,"title",True) # u'$title' on line 8, col 8
-        if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 8, col 8.
-        write(u'''</title>
+        _v = VFFSL(SL,"title",True) # u'$title' on line 9, col 8
+        if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 9, col 8.
+        write(u''' \u2014 m_Librarian</title>
 <meta name="author" content="Oleg Broytman">
 <meta name="copyright" content="&copy; 2018 PhiloSoft Design">
 <link rev="made" href="mailto:phd@phdru.name">
 <meta name="generator" content="CheetahTemplate">
 <meta name="MSSmartTagsPreventParsing" content="TRUE"> <!-- MUST DIE -->
 </head>
-<body bgcolor="#CCCCCC" text="#000000"
+<body bgcolor="#FFFFFF" text="#000000"
       link="#0000bb"  vlink="#551a8b" alink="#ff0000">
+<table style="width: 100%">
+<tr style="width: 100%">
+  <td style="width: 50%"><p>m_Librarian</p></td>
+  <td style="width: 50%; text-align: right"><a href="/quit">\u0412\u044b\u0445\u043e\u0434</a></td>
+</tr>
+</table>
 ''')
-        _v = VFFSL(SL,"body",True) # u'$body' on line 17, col 1
-        if _v is not None: write(_filter(_v, rawExpr=u'$body')) # from line 17, col 1.
+        _v = VFFSL(SL,"body",True) # u'$body' on line 24, col 1
+        if _v is not None: write(_filter(_v, rawExpr=u'$body')) # from line 24, col 1.
         write(u'''
 </body>
 </html>
index 60da30eb0e8baa04331439f393009b9f372eee20..778cafb914f6419a360930afb188fd3d5f5401cf 100644 (file)
@@ -1,19 +1,26 @@
+#encoding utf-8
 #attr $title = ''
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
 <html>
 <!-- THIS PAGE IS AUTOMATICALLY GENERATED USING CheetahTemplate. DO NOT EDIT. -->
 <head>
-<meta HTTP-Equiv="Content-Type" content="text/html">
-<title>$title</title>
+<meta HTTP-Equiv="Content-Type" content="text/html; charset=utf-8">
+<title>$title — m_Librarian</title>
 <meta name="author" content="Oleg Broytman">
 <meta name="copyright" content="&copy; 2018 PhiloSoft Design">
 <link rev="made" href="mailto:phd@phdru.name">
 <meta name="generator" content="CheetahTemplate">
 <meta name="MSSmartTagsPreventParsing" content="TRUE"> <!-- MUST DIE -->
 </head>
-<body bgcolor="#CCCCCC" text="#000000"
+<body bgcolor="#FFFFFF" text="#000000"
       link="#0000bb"  vlink="#551a8b" alink="#ff0000">
+<table style="width: 100%">
+<tr style="width: 100%">
+  <td style="width: 50%"><p>m_Librarian</p></td>
+  <td style="width: 50%; text-align: right"><a href="/quit">Выход</a></td>
+</tr>
+</table>
 $body
 </body>
 </html>
diff --git a/m_librarian/web/views/list_authors.py b/m_librarian/web/views/list_authors.py
new file mode 100644 (file)
index 0000000..f38c9c4
--- /dev/null
@@ -0,0 +1,184 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+
+
+##################################################
+## DEPENDENCIES
+import sys
+import os
+import os.path
+try:
+    import builtins as builtin
+except ImportError:
+    import __builtin__ as builtin
+from os.path import getmtime, exists
+import time
+import types
+from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
+from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
+from Cheetah.Template import Template
+from Cheetah.DummyTransaction import *
+from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
+from Cheetah.CacheRegion import CacheRegion
+import Cheetah.Filters as Filters
+import Cheetah.ErrorCatchers as ErrorCatchers
+from Cheetah.compat import unicode
+from views.layout import layout
+
+##################################################
+## MODULE CONSTANTS
+VFFSL=valueFromFrameOrSearchList
+VFSL=valueFromSearchList
+VFN=valueForName
+currentTime=time.time
+__CHEETAH_version__ = '3.1.0'
+__CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
+__CHEETAH_genTime__ = 1522957487.491209
+__CHEETAH_genTimestamp__ = 'Thu Apr  5 22:44:47 2018'
+__CHEETAH_src__ = 'list_authors.tmpl'
+__CHEETAH_srcLastModified__ = 'Thu Apr  5 22:42:57 2018'
+__CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
+
+if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
+    raise AssertionError(
+      'This template was compiled with Cheetah version'
+      ' %s. Templates compiled before version %s must be recompiled.'%(
+         __CHEETAH_version__, RequiredCheetahVersion))
+
+##################################################
+## CLASSES
+
+class list_authors(layout):
+
+    ##################################################
+    ## CHEETAH GENERATED METHODS
+
+
+    def __init__(self, *args, **KWs):
+
+        super(list_authors, self).__init__(*args, **KWs)
+        if not self._CHEETAH__instanceInitialized:
+            cheetahKWArgs = {}
+            allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
+            for k,v in KWs.items():
+                if k in allowedKWs: cheetahKWArgs[k] = v
+            self._initCheetahInstance(**cheetahKWArgs)
+        
+
+    def body(self, **KWS):
+
+
+
+        ## CHEETAH: generated from #def body at line 4, col 1.
+        trans = KWS.get("trans")
+        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
+            trans = self.transaction # is None unless self.awake() was called
+        if not trans:
+            trans = DummyTransaction()
+            _dummyTrans = True
+        else: _dummyTrans = False
+        write = trans.response().write
+        SL = self._CHEETAH__searchList
+        _filter = self._CHEETAH__currentFilter
+        
+        ########################################
+        ## START - generated method body
+        
+        write(u'''<h1>''')
+        _v = VFFSL(SL,"title",True) # u'$title' on line 5, col 5
+        if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 5, col 5.
+        write(u'''</h1>
+
+''')
+        if VFFSL(SL,"authors",True): # generated from line 7, col 1
+            write(u'''  <table>
+''')
+            for author in VFFSL(SL,"authors",True): # generated from line 9, col 3
+                write(u'''  <tr>
+    <td>''')
+                _v = VFFSL(SL,"author.fullname",True) # u'$author.fullname' on line 11, col 9
+                if _v is not None: write(_filter(_v, rawExpr=u'$author.fullname')) # from line 11, col 9.
+                write(u'''</td>
+  </tr>
+''')
+            write(u'''  </table>
+''')
+        else: # generated from line 15, col 1
+            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>
+''')
+        
+        ########################################
+        ## END - generated method body
+        
+        return _dummyTrans and trans.response().getvalue() or ""
+        
+
+    def writeBody(self, **KWS):
+
+
+
+        ## CHEETAH: main method generated for this template
+        trans = KWS.get("trans")
+        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
+            trans = self.transaction # is None unless self.awake() was called
+        if not trans:
+            trans = DummyTransaction()
+            _dummyTrans = True
+        else: _dummyTrans = False
+        write = trans.response().write
+        SL = self._CHEETAH__searchList
+        _filter = self._CHEETAH__currentFilter
+        
+        ########################################
+        ## START - generated method body
+        
+        
+        ########################################
+        ## END - generated method body
+        
+        return _dummyTrans and trans.response().getvalue() or ""
+        
+    ##################################################
+    ## CHEETAH GENERATED ATTRIBUTES
+
+
+    _CHEETAH__instanceInitialized = False
+
+    _CHEETAH_version = __CHEETAH_version__
+
+    _CHEETAH_versionTuple = __CHEETAH_versionTuple__
+
+    _CHEETAH_genTime = __CHEETAH_genTime__
+
+    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
+
+    _CHEETAH_src = __CHEETAH_src__
+
+    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
+
+    title = 'Список авторов'
+
+    _mainCheetahMethod_for_list_authors = 'writeBody'
+
+## END CLASS DEFINITION
+
+if not hasattr(list_authors, '_initCheetahAttributes'):
+    templateAPIClass = getattr(list_authors,
+                               '_CHEETAH_templateClass',
+                               Template)
+    templateAPIClass._addCheetahPlumbingCodeToClass(list_authors)
+
+
+# CHEETAH was developed by Tavis Rudd and Mike Orr
+# with code, advice and input from many other volunteers.
+# For more information visit http://cheetahtemplate.org/
+
+##################################################
+## if run from command line:
+if __name__ == '__main__':
+    from Cheetah.TemplateCmdLineIface import CmdLineIface
+    CmdLineIface(templateObj=list_authors()).run()
+
+
diff --git a/m_librarian/web/views/list_authors.tmpl b/m_librarian/web/views/list_authors.tmpl
new file mode 100644 (file)
index 0000000..b0b20ad
--- /dev/null
@@ -0,0 +1,18 @@
+#encoding utf-8
+#extends views.layout
+#attr $title = 'Список авторов'
+#def body
+<h1>$title</h1>
+
+#if $authors
+  <table>
+  #for $author in $authors
+  <tr>
+    <td>$author.fullname</td>
+  </tr>
+  #end for
+  </table>
+#else
+  <p>Не найдено ни одного автора!</p>
+#end if
+#end def
diff --git a/m_librarian/web/views/search_authors.py b/m_librarian/web/views/search_authors.py
new file mode 100644 (file)
index 0000000..fdc4a4b
--- /dev/null
@@ -0,0 +1,173 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+
+
+##################################################
+## DEPENDENCIES
+import sys
+import os
+import os.path
+try:
+    import builtins as builtin
+except ImportError:
+    import __builtin__ as builtin
+from os.path import getmtime, exists
+import time
+import types
+from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
+from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
+from Cheetah.Template import Template
+from Cheetah.DummyTransaction import *
+from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
+from Cheetah.CacheRegion import CacheRegion
+import Cheetah.Filters as Filters
+import Cheetah.ErrorCatchers as ErrorCatchers
+from Cheetah.compat import unicode
+from views.layout import layout
+from views.search_authors_form import search_authors_form
+
+##################################################
+## MODULE CONSTANTS
+VFFSL=valueFromFrameOrSearchList
+VFSL=valueFromSearchList
+VFN=valueForName
+currentTime=time.time
+__CHEETAH_version__ = '3.1.0'
+__CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
+__CHEETAH_genTime__ = 1522952816.408144
+__CHEETAH_genTimestamp__ = 'Thu Apr  5 21:26:56 2018'
+__CHEETAH_src__ = 'search_authors.tmpl'
+__CHEETAH_srcLastModified__ = 'Thu Apr  5 21:26:43 2018'
+__CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
+
+if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
+    raise AssertionError(
+      'This template was compiled with Cheetah version'
+      ' %s. Templates compiled before version %s must be recompiled.'%(
+         __CHEETAH_version__, RequiredCheetahVersion))
+
+##################################################
+## CLASSES
+
+class search_authors(layout):
+
+    ##################################################
+    ## CHEETAH GENERATED METHODS
+
+
+    def __init__(self, *args, **KWs):
+
+        super(search_authors, self).__init__(*args, **KWs)
+        if not self._CHEETAH__instanceInitialized:
+            cheetahKWArgs = {}
+            allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
+            for k,v in KWs.items():
+                if k in allowedKWs: cheetahKWArgs[k] = v
+            self._initCheetahInstance(**cheetahKWArgs)
+        
+
+    def body(self, **KWS):
+
+
+
+        ## CHEETAH: generated from #def body at line 4, col 1.
+        trans = KWS.get("trans")
+        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
+            trans = self.transaction # is None unless self.awake() was called
+        if not trans:
+            trans = DummyTransaction()
+            _dummyTrans = True
+        else: _dummyTrans = False
+        write = trans.response().write
+        SL = self._CHEETAH__searchList
+        _filter = self._CHEETAH__currentFilter
+        
+        ########################################
+        ## START - generated method body
+        
+        write(u'''<h1>''')
+        _v = VFFSL(SL,"title",True) # u'$title' on line 5, col 5
+        if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 5, col 5.
+        write(u'''</h1>
+
+''')
+        _v = VFFSL(SL,"search_authors_form",False)() # u'$search_authors_form()' on line 8, col 1
+        if _v is not None: write(_filter(_v, rawExpr=u'$search_authors_form()')) # from line 8, col 1.
+        write(u'''
+''')
+        
+        ########################################
+        ## END - generated method body
+        
+        return _dummyTrans and trans.response().getvalue() or ""
+        
+
+    def writeBody(self, **KWS):
+
+
+
+        ## CHEETAH: main method generated for this template
+        trans = KWS.get("trans")
+        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
+            trans = self.transaction # is None unless self.awake() was called
+        if not trans:
+            trans = DummyTransaction()
+            _dummyTrans = True
+        else: _dummyTrans = False
+        write = trans.response().write
+        SL = self._CHEETAH__searchList
+        _filter = self._CHEETAH__currentFilter
+        
+        ########################################
+        ## START - generated method body
+        
+        
+        ########################################
+        ## END - generated method body
+        
+        return _dummyTrans and trans.response().getvalue() or ""
+        
+    ##################################################
+    ## CHEETAH GENERATED ATTRIBUTES
+
+
+    _CHEETAH__instanceInitialized = False
+
+    _CHEETAH_version = __CHEETAH_version__
+
+    _CHEETAH_versionTuple = __CHEETAH_versionTuple__
+
+    _CHEETAH_genTime = __CHEETAH_genTime__
+
+    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
+
+    _CHEETAH_src = __CHEETAH_src__
+
+    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
+
+    title = 'Поиск авторов'
+
+    _mainCheetahMethod_for_search_authors = 'writeBody'
+
+## END CLASS DEFINITION
+
+if not hasattr(search_authors, '_initCheetahAttributes'):
+    templateAPIClass = getattr(search_authors,
+                               '_CHEETAH_templateClass',
+                               Template)
+    templateAPIClass._addCheetahPlumbingCodeToClass(search_authors)
+
+
+# CHEETAH was developed by Tavis Rudd and Mike Orr
+# with code, advice and input from many other volunteers.
+# For more information visit http://cheetahtemplate.org/
+
+##################################################
+## if run from command line:
+if __name__ == '__main__':
+    from Cheetah.TemplateCmdLineIface import CmdLineIface
+    CmdLineIface(templateObj=search_authors()).run()
+
+
diff --git a/m_librarian/web/views/search_authors.tmpl b/m_librarian/web/views/search_authors.tmpl
new file mode 100644 (file)
index 0000000..b659f38
--- /dev/null
@@ -0,0 +1,9 @@
+#encoding utf-8
+#extends views.layout
+#attr $title = 'Поиск авторов'
+#def body
+<h1>$title</h1>
+
+#from views.search_authors_form import search_authors_form
+$search_authors_form()
+#end def
diff --git a/m_librarian/web/views/search_authors_form.py b/m_librarian/web/views/search_authors_form.py
new file mode 100644 (file)
index 0000000..1e30443
--- /dev/null
@@ -0,0 +1,148 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+
+
+##################################################
+## DEPENDENCIES
+import sys
+import os
+import os.path
+try:
+    import builtins as builtin
+except ImportError:
+    import __builtin__ as builtin
+from os.path import getmtime, exists
+import time
+import types
+from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
+from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
+from Cheetah.Template import Template
+from Cheetah.DummyTransaction import *
+from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
+from Cheetah.CacheRegion import CacheRegion
+import Cheetah.Filters as Filters
+import Cheetah.ErrorCatchers as ErrorCatchers
+from Cheetah.compat import unicode
+
+##################################################
+## MODULE CONSTANTS
+VFFSL=valueFromFrameOrSearchList
+VFSL=valueFromSearchList
+VFN=valueForName
+currentTime=time.time
+__CHEETAH_version__ = '3.1.0'
+__CHEETAH_versionTuple__ = (3, 1, 0, 'final', 1)
+__CHEETAH_genTime__ = 1522958937.217914
+__CHEETAH_genTimestamp__ = 'Thu Apr  5 23:08:57 2018'
+__CHEETAH_src__ = 'search_authors_form.tmpl'
+__CHEETAH_srcLastModified__ = 'Thu Apr  5 23:08:55 2018'
+__CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
+
+if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
+    raise AssertionError(
+      'This template was compiled with Cheetah version'
+      ' %s. Templates compiled before version %s must be recompiled.'%(
+         __CHEETAH_version__, RequiredCheetahVersion))
+
+##################################################
+## CLASSES
+
+class search_authors_form(Template):
+
+    ##################################################
+    ## CHEETAH GENERATED METHODS
+
+
+    def __init__(self, *args, **KWs):
+
+        super(search_authors_form, self).__init__(*args, **KWs)
+        if not self._CHEETAH__instanceInitialized:
+            cheetahKWArgs = {}
+            allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
+            for k,v in KWs.items():
+                if k in allowedKWs: cheetahKWArgs[k] = v
+            self._initCheetahInstance(**cheetahKWArgs)
+        
+
+    def respond(self, trans=None):
+
+
+
+        ## CHEETAH: main method generated for this template
+        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
+            trans = self.transaction # is None unless self.awake() was called
+        if not trans:
+            trans = DummyTransaction()
+            _dummyTrans = True
+        else: _dummyTrans = False
+        write = trans.response().write
+        SL = self._CHEETAH__searchList
+        _filter = self._CHEETAH__currentFilter
+        
+        ########################################
+        ## START - generated method body
+        
+        write(u'''<form action="/search_authors/" method="POST">
+  <input name="search_authors" type="text" style="width: 80%">
+  <br>
+  <input name="search_type" value="start" type="radio">
+  \u041f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0430 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435
+  <input name="search_type" value="substring" type="radio">
+  \u041f\u043e\u0434\u0441\u0442\u0440\u043e\u043a\u0430
+  <input name="search_type" value="full" type="radio">
+  \u0422\u043e\u0447\u043d\u043e\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435
+  <br>
+  <input name="case_sensitive" type="checkbox">
+  \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
+  <br>
+  <input name="submit" type="submit">
+</form>
+''')
+        
+        ########################################
+        ## END - generated method body
+        
+        return _dummyTrans and trans.response().getvalue() or ""
+        
+    ##################################################
+    ## CHEETAH GENERATED ATTRIBUTES
+
+
+    _CHEETAH__instanceInitialized = False
+
+    _CHEETAH_version = __CHEETAH_version__
+
+    _CHEETAH_versionTuple = __CHEETAH_versionTuple__
+
+    _CHEETAH_genTime = __CHEETAH_genTime__
+
+    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__
+
+    _CHEETAH_src = __CHEETAH_src__
+
+    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__
+
+    _mainCheetahMethod_for_search_authors_form = 'respond'
+
+## END CLASS DEFINITION
+
+if not hasattr(search_authors_form, '_initCheetahAttributes'):
+    templateAPIClass = getattr(search_authors_form,
+                               '_CHEETAH_templateClass',
+                               Template)
+    templateAPIClass._addCheetahPlumbingCodeToClass(search_authors_form)
+
+
+# CHEETAH was developed by Tavis Rudd and Mike Orr
+# with code, advice and input from many other volunteers.
+# For more information visit http://cheetahtemplate.org/
+
+##################################################
+## if run from command line:
+if __name__ == '__main__':
+    from Cheetah.TemplateCmdLineIface import CmdLineIface
+    CmdLineIface(templateObj=search_authors_form()).run()
+
+
diff --git a/m_librarian/web/views/search_authors_form.tmpl b/m_librarian/web/views/search_authors_form.tmpl
new file mode 100644 (file)
index 0000000..ec73155
--- /dev/null
@@ -0,0 +1,16 @@
+#encoding utf-8
+<form action="/search_authors/" method="POST">
+  <input name="search_authors" type="text" style="width: 80%">
+  <br>
+  <input name="search_type" value="start" type="radio">
+  Подстрока в начале
+  <input name="search_type" value="substring" type="radio">
+  Подстрока
+  <input name="search_type" value="full" type="radio">
+  Точное совпадение
+  <br>
+  <input name="case_sensitive" type="checkbox">
+  Различать прописные/строчные
+  <br>
+  <input name="submit" type="submit">
+</form>