You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-python/tempita/files/tempita-0.5.3-cgi-escape.patch

32 lines
1.1 KiB

diff --git a/tempita/__init__.py b/tempita/__init__.py
index 137ba2d..acc2fd9 100755
--- a/tempita/__init__.py
+++ b/tempita/__init__.py
@@ -31,12 +31,12 @@ can use ``__name='tmpl.html'`` to set the name of the template.
If there are syntax errors ``TemplateError`` will be raised.
"""
-import cgi
import os
import re
import sys
import tokenize
from cStringIO import StringIO
+from html import escape
from urllib import quote as url_quote
from tempita._looper import looper
from tempita.compat3 import bytes, basestring_, next, is_unicode, coerce_text
@@ -445,10 +445,10 @@ def html_quote(value, force=True):
if not isinstance(value, basestring_):
value = coerce_text(value)
if sys.version >= "3" and isinstance(value, bytes):
- value = cgi.escape(value.decode('latin1'), 1)
+ value = escape(value.decode('latin1'), 1)
value = value.encode('latin1')
else:
- value = cgi.escape(value, 1)
+ value = escape(value, 1)
if sys.version < "3":
if is_unicode(value):
value = value.encode('ascii', 'xmlcharrefreplace')