Switch from the depreciated cgi module to the html module
authorKarl O. Pinc <kop@karlpinc.com>
Fri, 23 Feb 2024 15:59:13 +0000 (09:59 -0600)
committerKarl O. Pinc <kop@karlpinc.com>
Fri, 23 Feb 2024 15:59:13 +0000 (09:59 -0600)
src/pgwui_core/exceptions.py

index b79bac933964f7386fc792eeed5b66de83debbca..c90536caec58424d0f036599757600d3e54690f0 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2013, 2014, 2015, 2018, 2020, 2021 The Meme Factory, Inc.
+# Copyright (C) 2013, 2014, 2015, 2018, 2020, 2021, 2024 The Meme Factory, Inc.
 #               http://www.karlpinc.com/
 
 # This file is part of PGWUI_Core.
@@ -23,7 +23,7 @@
 '''Exceptions
 '''
 
-from cgi import escape as cgi_escape
+from html import escape as html_escape
 
 
 class PGWUIError(Exception):
@@ -197,17 +197,17 @@ class DBError(SetupError):
         Produce an html formatted message from a psycopg2 DatabaseError
         exception.
         '''
-        primary = cgi_escape(ex.diag.message_primary)
+        primary = html_escape(ex.diag.message_primary)
 
         if ex.diag.message_detail is None:
             detail = ''
         else:
-            detail = '<br />DETAIL: ' + cgi_escape(ex.diag.message_detail)
+            detail = '<br />DETAIL: ' + html_escape(ex.diag.message_detail)
 
         if ex.diag.message_hint is None:
             hint = ''
         else:
-            hint = '<br />HINT: ' + cgi_escape(ex.diag.message_hint)
+            hint = '<br />HINT: ' + html_escape(ex.diag.message_hint)
 
         return '<blockquote><p>{0}: {1}{2}{3}</p></blockquote>'.format(
             ex.diag.severity,