Use `html.escape` for Python versions where `cgi.escape` is removed (#600)

Use html.escape as cgi.escape is removed in 3.8
master
Shimmy Xu 4 years ago committed by Jelmer Vernooij
parent 2e8cb81179
commit 7eed747e7a

@ -3,7 +3,6 @@
from __future__ import unicode_literals
import re
import cgi
import time
import functools
import json # json.dumps to put URL in <script>
@ -29,6 +28,10 @@ from isso.views import requires
from isso.utils.hash import sha1
from isso.utils.hash import md5
try:
from cgi import escape
except ImportError:
from html import escape
try:
from urlparse import urlparse
except ImportError:
@ -263,7 +266,7 @@ class API(object):
for field in ("author", "email", "website"):
if data.get(field) is not None:
data[field] = cgi.escape(data[field])
data[field] = escape(data[field], quote=False)
if data.get("website"):
data["website"] = normalize(data["website"])

Loading…
Cancel
Save