summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-06-22 11:57:18 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-06-22 11:57:18 -0400
commit808dde1450ace1a929d2f6a289bd3e6293c84bad (patch)
treee4befca0e7c86bbaa925a2c89e2ed097c1e9e374
parent6fbcfe7a4df62f0b217539b9c931d1068e947b70 (diff)
downloadmako-808dde1450ace1a929d2f6a289bd3e6293c84bad.tar.gz
- Fixed call to "unicode.strip" in
exceptions.text_error_template which is not Py3k compatible. [ticket:137]
-rw-r--r--CHANGES6
-rw-r--r--mako/__init__.py2
-rw-r--r--mako/exceptions.py2
-rw-r--r--test/test_exceptions.py20
4 files changed, 23 insertions, 7 deletions
diff --git a/CHANGES b/CHANGES
index d9fd1a4..6ff3824 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,8 @@
-
+0.3.4
+- Fixed call to "unicode.strip" in
+ exceptions.text_error_template which
+ is not Py3k compatible. [ticket:137]
+
0.3.3
- Added conditional to RichTraceback
such that if no traceback is passed
diff --git a/mako/__init__.py b/mako/__init__.py
index 336d7a8..2d13593 100644
--- a/mako/__init__.py
+++ b/mako/__init__.py
@@ -5,5 +5,5 @@
# the MIT License: http://www.opensource.org/licenses/mit-license.php
-__version__ = '0.3.3'
+__version__ = '0.3.4'
diff --git a/mako/exceptions.py b/mako/exceptions.py
index 6e95751..b9df87e 100644
--- a/mako/exceptions.py
+++ b/mako/exceptions.py
@@ -247,7 +247,7 @@ def text_error_template(lookup=None):
Traceback (most recent call last):
% for (filename, lineno, function, line) in tback.traceback:
File "${filename}", line ${lineno}, in ${function or '?'}
- ${line | unicode.strip}
+ ${line | trim}
% endfor
${tback.errorname}: ${tback.message}
""")
diff --git a/test/test_exceptions.py b/test/test_exceptions.py
index 13be3a8..c136725 100644
--- a/test/test_exceptions.py
+++ b/test/test_exceptions.py
@@ -17,12 +17,12 @@ class ExceptionsTest(TemplateTest):
try:
template = Template(code)
template.render_unicode()
+ assert False
except exceptions.CompileException, ce:
html_error = exceptions.html_error_template().render_unicode()
assert ("CompileException: Fragment 'i = 0' is not a partial "
"control statement") in html_error
assert '<style>' in html_error
- assert '</style>' in html_error
html_error_stripped = html_error.strip()
assert html_error_stripped.startswith('<html>')
assert html_error_stripped.endswith('</html>')
@@ -30,18 +30,30 @@ class ExceptionsTest(TemplateTest):
not_full = exceptions.html_error_template().\
render_unicode(full=False)
assert '<html>' not in not_full
- assert '</html>' not in not_full
assert '<style>' in not_full
- assert '</style>' in not_full
no_css = exceptions.html_error_template().\
render_unicode(css=False)
assert '<style>' not in no_css
- assert '</style>' not in no_css
else:
assert False, ("This function should trigger a CompileException, "
"but didn't")
+ def test_text_error_template(self):
+ code = """
+% i = 0
+"""
+ try:
+ template = Template(code)
+ template.render_unicode()
+ assert False
+ except exceptions.CompileException, ce:
+ text_error = exceptions.text_error_template().render_unicode()
+ assert 'Traceback (most recent call last):' in text_error
+ assert ("CompileException: Fragment 'i = 0' is not a partial "
+ "control statement") in text_error
+
+
def test_utf8_html_error_template(self):
"""test the html_error_template with a Template containing utf8
chars"""