aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_template.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-01-16 13:13:03 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2012-01-16 13:13:03 -0500
commit96998dd9fbf060cb873176440b75c51238e1c4ba (patch)
treea6e3e821f60f284592fd82b2451526ae1f2045d3 /test/test_template.py
parent0050ca812536b4dce06d3e4a811e451676c0e60a (diff)
downloadexternal_python_mako-96998dd9fbf060cb873176440b75c51238e1c4ba.tar.gz
external_python_mako-96998dd9fbf060cb873176440b75c51238e1c4ba.tar.bz2
external_python_mako-96998dd9fbf060cb873176440b75c51238e1c4ba.zip
- [bug] The exception message in the html_error_template
is now escaped with the HTML filter. [ticket:142]
Diffstat (limited to 'test/test_template.py')
-rw-r--r--test/test_template.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test_template.py b/test/test_template.py
index 4d301aa..ddab16e 100644
--- a/test/test_template.py
+++ b/test/test_template.py
@@ -12,6 +12,23 @@ from test import TemplateTest, eq_, template_base, module_base, \
skip_if, assert_raises, assert_raises_message
class EncodingTest(TemplateTest):
+ def test_escapes_html_tags(self):
+ from mako.exceptions import html_error_template
+
+ x = Template("""
+ X:
+ <% raise Exception('<span style="color:red">Foobar</span>') %>
+ """)
+
+ try:
+ x.render()
+ except:
+ # <h3>Exception: <span style="color:red">Foobar</span></h3>
+ markup = html_error_template().render(full=False, css=False)
+ print markup
+ assert '<span style="color:red">Foobar</span></h3>' not in markup
+ assert '&lt;span style=&#34;color:red&#34;&gt;Foobar&lt;/span&gt;' in markup
+
def test_unicode(self):
self._do_memory_test(
u"""Alors vous imaginez ma surprise, au lever du jour, quand une drôle de petite voix m’a réveillé. Elle disait: « S’il vous plaît… dessine-moi un mouton! »""",