Commit 975ceaca authored by Nsukami Patrick's avatar Nsukami Patrick
Browse files

Remove obsolete function html_escape

- add a `callable_deprecated` warning on html_escape
- use xml_escape function instead of html_escape function
parent 199bcfc5b0aa
Pipeline #10768 passed with stages
in 4 minutes and 12 seconds
......@@ -39,6 +39,8 @@ except AttributeError:
import codecs
from io import BytesIO
from logilab.common import deprecation
from html.entities import name2codepoint
import pkg_resources
......@@ -147,12 +149,6 @@ ESC_CAR_TABLE = maketrans(
ESC_UCAR_TABLE = ESC_CAR_TABLE.decode("latin1")
# XXX deprecate at some point (once less used :)
# @obsolete('use xml_escape')
def html_escape(data):
return xml_escape(data)
def xml_escape(data):
"""escapes XML forbidden characters in attributes and PCDATA"""
if isinstance(data, str):
......@@ -168,6 +164,9 @@ def xml_escape(data):
)
html_escape = deprecation.renamed("html_escape", xml_escape)
def html_unescape(data):
"""unescapes XML/HTML entities"""
for entityname, codepoint in name2codepoint.items():
......
......@@ -33,7 +33,7 @@ Original code from active state recipe
"""
from logilab.common import deprecation
from logilab.mtconverter import html_escape
from logilab.mtconverter import xml_escape
from logilab.mtconverter.transform import Transform
import keyword
import token
......@@ -111,7 +111,7 @@ class Parser:
close_tag = self.tags.get("CLOSE_" + toktype, self.tags["CLOSE_TEXT"])
# send text
self.out.write(open_tag)
self.out.write(html_escape(toktext))
self.out.write(xml_escape(toktext))
self.out.write(close_tag)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment