Use html.escape
for Python versions where cgi.escape
is removed (#600)
Use html.escape as cgi.escape is removed in 3.8
This commit is contained in:
parent
2e8cb81179
commit
7eed747e7a
@ -3,7 +3,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import cgi
|
|
||||||
import time
|
import time
|
||||||
import functools
|
import functools
|
||||||
import json # json.dumps to put URL in <script>
|
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 sha1
|
||||||
from isso.utils.hash import md5
|
from isso.utils.hash import md5
|
||||||
|
|
||||||
|
try:
|
||||||
|
from cgi import escape
|
||||||
|
except ImportError:
|
||||||
|
from html import escape
|
||||||
try:
|
try:
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -263,7 +266,7 @@ class API(object):
|
|||||||
|
|
||||||
for field in ("author", "email", "website"):
|
for field in ("author", "email", "website"):
|
||||||
if data.get(field) is not None:
|
if data.get(field) is not None:
|
||||||
data[field] = cgi.escape(data[field])
|
data[field] = escape(data[field], quote=False)
|
||||||
|
|
||||||
if data.get("website"):
|
if data.get("website"):
|
||||||
data["website"] = normalize(data["website"])
|
data["website"] = normalize(data["website"])
|
||||||
|
Loading…
Reference in New Issue
Block a user