From: Ben Darnell Date: Fri, 5 Jul 2013 16:46:49 +0000 (-0400) Subject: Add apostrophes to xhtml_escape. X-Git-Tag: v3.2.0b1~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f2c3b36c15832c34e254eeaeb4d2817e9608e20;p=thirdparty%2Ftornado.git Add apostrophes to xhtml_escape. Closes #833. --- diff --git a/tornado/escape.py b/tornado/escape.py index 91c3e7408..4e2d20d75 100644 --- a/tornado/escape.py +++ b/tornado/escape.py @@ -49,8 +49,9 @@ try: except NameError: unichr = chr -_XHTML_ESCAPE_RE = re.compile('[&<>"]') -_XHTML_ESCAPE_DICT = {'&': '&', '<': '<', '>': '>', '"': '"'} +_XHTML_ESCAPE_RE = re.compile('[&<>"\']') +_XHTML_ESCAPE_DICT = {'&': '&', '<': '<', '>': '>', '"': '"', + '\'': '''} def xhtml_escape(value): diff --git a/tornado/test/escape_test.py b/tornado/test/escape_test.py index 0370d77da..9abc74803 100644 --- a/tornado/test/escape_test.py +++ b/tornado/test/escape_test.py @@ -144,7 +144,7 @@ class EscapeTestCase(unittest.TestCase): (u(""), u("<foo>")), (b"", b"<foo>"), - ("<>&\"", "<>&""), + ("<>&\"'", "<>&"'"), ("&", "&amp;"), (u("<\u00e9>"), u("<\u00e9>")),