lists.arthurdejong.org
RSS feed

python-stdnum branch master updated. 1.17-48-gf972894

[Date Prev][Date Next] [Thread Prev][Thread Next]

python-stdnum branch master updated. 1.17-48-gf972894



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "python-stdnum".

The branch, master has been updated
       via  f9728949cd1477868b656c2583f2568c6c28dce7 (commit)
      from  c5d3bf4a409e2e709dc81c73ab86419e42ab7f14 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/python-stdnum/commit/?id=f9728949cd1477868b656c2583f2568c6c28dce7

commit f9728949cd1477868b656c2583f2568c6c28dce7
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sun Oct 23 17:29:23 2022 +0200

    Switch to escape() from html
    
    The function was removed from the cgi module in Python 3.8.

diff --git a/online_check/stdnum.wsgi b/online_check/stdnum.wsgi
index 62e2d58..74da5b4 100755
--- a/online_check/stdnum.wsgi
+++ b/online_check/stdnum.wsgi
@@ -19,6 +19,7 @@
 
 """Simple WSGI application to check numbers."""
 
+import html
 import inspect
 import json
 import os
@@ -69,7 +70,7 @@ def info(module, number):
 
 def format(data):
     """Return an HTML snippet describing the number."""
-    description = cgi.escape(data['description']).replace('\n\n', '<br/>\n')
+    description = html.escape(data['description']).replace('\n\n', '<br/>\n')
     description = re.sub(
         r'^[*] (.*)$', r'<ul><li>\1</li></ul>',
         description, flags=re.MULTILINE)
@@ -79,10 +80,10 @@ def format(data):
         description, flags=re.IGNORECASE + re.UNICODE)
     for name, conversion in data.get('conversions', {}).items():
         description += '\n<br/><b><i>%s</i></b>: %s' % (
-            cgi.escape(name), cgi.escape(conversion))
+            html.escape(name), html.escape(conversion))
     return '<li>%s: <b>%s</b><p>%s</p></li>' % (
-        cgi.escape(data['number']),
-        cgi.escape(data['name']),
+        html.escape(data['number']),
+        html.escape(data['name']),
         description)
 
 
@@ -115,5 +116,5 @@ def application(environ, start_response):
         ('Content-Type', 'text/html; charset=utf-8'),
         ('Vary', 'X-Requested-With')])
     return [(_template % dict(
-        value=cgi.escape(number, True),
+        value=html.escape(number, True),
         results=u'\n'.join(format(data) for data in results))).encode('utf-8')]

-----------------------------------------------------------------------

Summary of changes:
 online_check/stdnum.wsgi | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
python-stdnum