diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-11-02 13:51:47 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-11-02 13:51:47 -0400 |
commit | b47783ace365e77d397578e90d74d96463c97a2b (patch) | |
tree | 8844b28bba2bf5079ee9c2f2a089ba05dafe21f8 | |
parent | 7286cb0b9ed7f1da50fea3ec345ae4a8dc69d92a (diff) | |
download | mako-b47783ace365e77d397578e90d74d96463c97a2b.tar.gz |
- [bug] legacy_html_escape function, used whenrel_0_7_3
Markupsafe isn't installed, was using an inline-compiled
regexp which causes major slowdowns on Python 3.3;
is now precompiled.
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | mako/filters.py | 4 |
2 files changed, 8 insertions, 1 deletions
@@ -1,5 +1,10 @@ 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 function arguments inside pure-python def or lambda expressions. [ticket:201] diff --git a/mako/filters.py b/mako/filters.py index 37c8fe4..b4f2684 100644 --- a/mako/filters.py +++ b/mako/filters.py @@ -20,10 +20,12 @@ xml_escapes = { # XXX: " is valid in HTML and XML # ' is not valid HTML, but is valid XML +LEGACY_HTML_ESCAPE_RE = re.compile(r'([&<"\'>])') + def legacy_html_escape(string): """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: import markupsafe |