Skip to content

Commit

Permalink
Avoid the deprecated cgi.escape
Browse files Browse the repository at this point in the history
Fixes test failures on Python 3.8 prereleases (where cgi.escape is not
just deprecated, but gone entirely).
  • Loading branch information
mgedmin committed Feb 12, 2019
1 parent bdf8846 commit 17eb4fe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/zope/tales/tales.py
Expand Up @@ -18,6 +18,11 @@
__docformat__ = "reStructuredText"
import re

try:
from html import escape
except ImportError:
from cgi import escape

from zope.interface import implementer
from zope.interface import Interface
import six
Expand Down Expand Up @@ -822,5 +827,4 @@ def getInfo(self, as_html=0):
if not as_html:
return ' - Names:\n %s' % s.replace('\n', '\n ')

from cgi import escape
return '<b>Names:</b><pre>%s</pre>' % (escape(s))

0 comments on commit 17eb4fe

Please sign in to comment.