Skip to content
Snippets Groups Projects
Commit b47783ac authored by Mike Bayer's avatar Mike Bayer
Browse files

- [bug] legacy_html_escape function, used when

  Markupsafe isn't installed, was using an inline-compiled
  regexp which causes major slowdowns on Python 3.3;
  is now precompiled.
parent 7286cb0b
No related branches found
No related tags found
No related merge requests found
0.7.3 0.7.3
- [bug] legacy_html_escape function, used when
Markupsafe isn't installed, was using an inline-compiled
regexp which causes major slowdowns on Python 3.3;
is now precompiled.
- [bug] AST supporting now supports tuple-packed - [bug] AST supporting now supports tuple-packed
function arguments inside pure-python def function arguments inside pure-python def
or lambda expressions. [ticket:201] or lambda expressions. [ticket:201]
......
...@@ -20,10 +20,12 @@ xml_escapes = { ...@@ -20,10 +20,12 @@ xml_escapes = {
# XXX: " is valid in HTML and XML # XXX: " is valid in HTML and XML
# ' is not valid HTML, but is valid XML # ' is not valid HTML, but is valid XML
LEGACY_HTML_ESCAPE_RE = re.compile(r'([&<"\'>])')
def legacy_html_escape(string): def legacy_html_escape(string):
"""legacy HTML escape for non-unicode mode.""" """legacy HTML escape for non-unicode mode."""
return re.sub(r'([&<"\'>])', lambda m: xml_escapes[m.group()], string) return LEGACY_HTML_ESCAPE_RE.sub(lambda m: xml_escapes[m.group()], string)
try: try:
import markupsafe import markupsafe
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment