]> git.phdru.name Git - m_librarian.git/commitdiff
Refactor(web): "search authors" is a form; "list authors" is the result
authorOleg Broytman <phd@phdru.name>
Mon, 8 Jul 2024 18:33:08 +0000 (21:33 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 8 Jul 2024 18:34:38 +0000 (21:34 +0300)
[skip ci]

m_librarian/web/app.py
m_librarian/web/views/search_authors_form.py
m_librarian/web/views/search_authors_form.tmpl

index 7885d4608d58cd15366430c3becb094ce7dec8a0..72f9104a425a3c86091da1d8890351c3b8cfb662 100644 (file)
@@ -28,9 +28,25 @@ def search_authors_get():
     return {}
 
 
-@route('/search_authors/', method='POST')
+@route('/list_authors', method='GET')
+def _list_authors():
+    return redirect('/list_authors/')
+
+
+@route('/list_authors/', method='GET')
+@cheetah_view('list_authors.tmpl')
+def list_authors_get():
+    value = request.query.get('search_authors')
+    if not value:
+        return redirect('/search_authors/')
+    search_type = request.query.get('search_type')
+    case_sensitive = request.query.get('case_sensitive')
+    return search_authors_raw(value, search_type, case_sensitive)
+
+
+@route('/list_authors/', method='POST')
 @cheetah_view('list_authors.tmpl')
-def search_authors_post():
+def list_authors_post():
     value = request.forms.get('search_authors')
     if not value:
         return redirect('/search_authors/')
index ab02908feafec37ac80a74aa440c6bef71da4313..78a1c36b7d3759ff8b2d6d3d05bb32dbe31b3adf 100644 (file)
@@ -35,10 +35,10 @@ VFN=valueForName
 currentTime=time.time
 __CHEETAH_version__ = '3.3.1'
 __CHEETAH_versionTuple__ = (3, 3, 1, 'final', 0)
-__CHEETAH_genTime__ = 1704845598.452284
-__CHEETAH_genTimestamp__ = 'Wed Jan 10 03:13:18 2024'
+__CHEETAH_genTime__ = 1720463312.154712
+__CHEETAH_genTimestamp__ = 'Mon Jul  8 21:28:32 2024'
 __CHEETAH_src__ = 'search_authors_form.tmpl'
-__CHEETAH_srcLastModified__ = 'Wed Jan 10 03:02:59 2024'
+__CHEETAH_srcLastModified__ = 'Mon Jul  8 21:28:30 2024'
 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
 
 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
@@ -141,7 +141,7 @@ class search_authors_form(Template):
         ########################################
         ## START - generated method body
         
-        write(u'''<form action="/search_authors/" method="POST">
+        write(u'''<form action="/list_authors/" method="POST">
   <div style="width: 100%">
   <input name="search_authors" value="''')
         _v = VFFSL(SL,"html_escape",False)(VFFSL(SL,"getVar",False)('search_authors',
index 721f149e73c22c0c5f0900dbc49c8c8b9e00e281..10fa94b87edbc81fbe809e7d12b9c595040176e6 100644 (file)
@@ -10,7 +10,7 @@ checked#slurp
 checked#slurp
 #end if
 #end def
-<form action="/search_authors/" method="POST">
+<form action="/list_authors/" method="POST">
   <div style="width: 100%">
   <input name="search_authors" value="$html_escape($getVar('search_authors',
   ''))" type="text" style="width: 100%">