diff -r 286dd28eadbc mako/filters.py
--- a/mako/filters.py Tue Jul 13 11:11:00 2010 -0400
+++ b/mako/filters.py Mon Jul 19 15:43:13 2010 -0400
@@ -8,7 +8,6 @@
import re, urllib, htmlentitydefs, codecs
from StringIO import StringIO
from mako import util
-import markupsafe
xml_escapes = {
'&' : '&',
@@ -21,13 +20,17 @@
# XXX: " is valid in HTML and XML
# ' is not valid HTML, but is valid XML
-def html_escape(string):
- return markupsafe.escape(string)
-
def legacy_html_escape(string):
"""legacy HTML escape for non-unicode mode."""
return re.sub(r'([&<"\'>])', lambda m: xml_escapes[m.group()], string)
+
+try:
+ import markupsafe
+ def html_escape(string):
+ return markupsafe.escape(string)
+except:
+ html_escape = legacy_html_escape
def xml_escape(string):
return re.sub(r'([&<"\'>])', lambda m: xml_escapes[m.group()], string)
> --
> You received this message because you are subscribed to the Google Groups "Mako Templates for Python" group.
> To post to this group, send email to mako-d...@googlegroups.com.
> To unsubscribe from this group, send email to mako-discuss...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mako-discuss?hl=en.
>