]> git.phdru.name Git - phdru.name/phdru.name.git/commitdiff
Refactor(reindex_blog.py): Get rid of `cgi`
authorOleg Broytman <phd@phdru.name>
Sat, 15 Jun 2024 22:37:01 +0000 (01:37 +0300)
committerOleg Broytman <phd@phdru.name>
Sat, 15 Jun 2024 22:37:01 +0000 (01:37 +0300)
reindex_blog.py

index bc34887d4076fe419cde94e4f7f1de2700e11749..68694488c816187d873c4427a21f8fb87785dfa8 100755 (executable)
@@ -5,7 +5,7 @@ __author__ = "Oleg Broytman <phd@phdru.name>"
 __copyright__ = "Copyright (C) 2006-2024 PhiloSoft Design"
 
 from calendar import _localized_month
-import cgi
+from html import escape
 import locale
 import sys, os
 from urllib.parse import quote, urljoin
@@ -485,7 +485,7 @@ class AbsURLHTMLParser(_HTMLParser):
     def start_a(self, attrs):
         self.accumulator += '<a'
         for attrname, value in attrs:
-            value = cgi.escape(value, True)
+            value = escape(value, True)
             if attrname == 'href':
                 self.accumulator += ' href="%s"' % urljoin(self.base, value)
             else:
@@ -498,7 +498,7 @@ class AbsURLHTMLParser(_HTMLParser):
     def start_img(self, attrs):
         self.accumulator += '<img'
         for attrname, value in attrs:
-            value = cgi.escape(value, True)
+            value = escape(value, True)
             if attrname == 'src':
                 self.accumulator += ' src="%s"' % urljoin(self.base, value)
             else: