]> git.phdru.name Git - m_librarian.git/blobdiff - m_librarian/web/views/list_books.py
Refactor(web): Use `#filter WebSafe` instead of `cgi.escape`
[m_librarian.git] / m_librarian / web / views / list_books.py
index 346f1252c3b6d8bc452d7afad6527857429c1a40..7a327ed08752b59ff85ef01387b178bab6a7a117 100644 (file)
@@ -25,7 +25,6 @@ from Cheetah.CacheRegion import CacheRegion
 import Cheetah.Filters as Filters
 import Cheetah.ErrorCatchers as ErrorCatchers
 from Cheetah.compat import unicode
-import cgi
 from m_librarian.translations import translations
 from views.layout import layout
 
@@ -35,12 +34,12 @@ VFFSL=valueFromFrameOrSearchList
 VFSL=valueFromSearchList
 VFN=valueForName
 currentTime=time.time
-__CHEETAH_version__ = '3.2.6'
-__CHEETAH_versionTuple__ = (3, 2, 6, 'final', 0)
-__CHEETAH_genTime__ = 1671305495.844598
-__CHEETAH_genTimestamp__ = 'Sat Dec 17 22:31:35 2022'
+__CHEETAH_version__ = '3.3.1'
+__CHEETAH_versionTuple__ = (3, 3, 1, 'final', 0)
+__CHEETAH_genTime__ = 1718725757.733093
+__CHEETAH_genTimestamp__ = 'Tue Jun 18 18:49:17 2024'
 __CHEETAH_src__ = 'list_books.tmpl'
-__CHEETAH_srcLastModified__ = 'Sat Dec 17 22:31:33 2022'
+__CHEETAH_srcLastModified__ = 'Tue Jun 18 18:49:15 2024'
 __CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'
 
 if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
@@ -73,7 +72,7 @@ class list_books(layout):
 
 
 
-        ## CHEETAH: generated from #def body at line 6, col 1.
+        ## CHEETAH: generated from #def body at line 5, 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
@@ -89,8 +88,8 @@ class list_books(layout):
         ## START - generated method body
         
         write(u'''<h1>''')
-        _v = VFFSL(SL,"title",True) # u'$title' on line 7, col 5
-        if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 7, col 5.
+        _v = VFFSL(SL,"title",True) # u'$title' on line 6, col 5
+        if _v is not None: write(_filter(_v, rawExpr=u'$title')) # from line 6, col 5.
         write(u'''</h1>
 
 <script type="text/javascript" language="Javascript">
@@ -117,7 +116,14 @@ function toggleSeries(name, value) {
 </script>
 
 ''')
-        if VFFSL(SL,"books_by_author",True): # generated from line 32, col 1
+        if VFFSL(SL,"books_by_author",True): # generated from line 31, col 1
+            _orig_filter_17563757 = _filter
+            filterName = u'WebSafe'
+            if "WebSafe" in self._CHEETAH__filters:
+                _filter = self._CHEETAH__currentFilter = self._CHEETAH__filters[filterName]
+            else:
+                _filter = self._CHEETAH__currentFilter = \
+                       self._CHEETAH__filters[filterName] = getattr(self._CHEETAH__filtersLib, filterName)(self).filter
             write(u'''  <form action="/download/" method="POST" style="height: 80%">
   <table style="width: 100%; height: 90%">
   <tr>
@@ -131,8 +137,8 @@ function toggleSeries(name, value) {
                 write(u'''    <td style="text-align: center">''')
                 if False:
                     _(VFFSL(SL,"column",True))
-                _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(VFFSL(SL,"_",False)(VFFSL(SL,"column",True))) # u'$cgi.escape($_($column))' on line 40, col 36
-                if _v is not None: write(_filter(_v, rawExpr=u'$cgi.escape($_($column))')) # from line 40, col 36.
+                _v = VFFSL(SL,"_",False)(VFFSL(SL,"column",True)) # u'$_($column)' on line 40, col 36
+                if _v is not None: write(_filter(_v, rawExpr=u'$_($column)')) # from line 40, col 36.
                 write(u'''</td>
 ''')
             write(u'''  </tr>
@@ -180,8 +186,9 @@ function toggleSeries(name, value) {
                         write(u''' \u2014 <i>
 ''')
                         if VFFSL(SL,"book.series",True): # generated from line 62, col 3
-                            _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(VFFSL(SL,"series",True), 1) # u'$cgi.escape($series, 1)' on line 63, col 1
-                            if _v is not None: write(_filter(_v, rawExpr=u'$cgi.escape($series, 1)')) # from line 63, col 1.
+                            _v = VFFSL(SL,"series",True) # u'$series' on line 63, col 1
+                            if _v is not None: write(_filter(_v, rawExpr=u'$series')) # from line 63, col 1.
+                            write(u''', 1''')
                         else: # generated from line 64, col 3
                             write(u'''\u0412\u043d\u0435 \u0441\u0435\u0440\u0438\u0439''')
                         write(u'''  </i></b></td>
@@ -208,8 +215,8 @@ function toggleSeries(name, value) {
                         _v = VFFSL(SL,"style",True) # u'$style' on line 78, col 6
                         if _v is not None: write(_filter(_v, rawExpr=u'$style')) # from line 78, col 6.
                         write(u'''>''')
-                        _v = VFN(VFFSL(SL,"cgi",True),"escape",False)(unicode(VFFSL(SL,"getattr",False)(VFFSL(SL,"book",True), VFFSL(SL,"column",True)) or '')) # u"$cgi.escape(unicode($getattr($book, $column) or ''))" on line 78, col 13
-                        if _v is not None: write(_filter(_v, rawExpr=u"$cgi.escape(unicode($getattr($book, $column) or ''))")) # from line 78, col 13.
+                        _v = VFFSL(SL,"unicode",False)(VFFSL(SL,"getattr",False)(VFFSL(SL,"book",True), VFFSL(SL,"column",True)) or '') # u"$unicode($getattr($book, $column) or '')" on line 78, col 13
+                        if _v is not None: write(_filter(_v, rawExpr=u"$unicode($getattr($book, $column) or '')")) # from line 78, col 13.
                         write(u'''</td>
 ''')
                     write(u'''  </tr>
@@ -223,7 +230,8 @@ function toggleSeries(name, value) {
   </table>
   </form>
 ''')
-        else: # generated from line 88, col 1
+            _filter = self._CHEETAH__currentFilter = _orig_filter_17563757
+        else: # generated from line 89, col 1
             write(u'''  <p>\u041d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u043a\u043d\u0438\u0433\u0438!</p>
 ''')