- fixed issue with inline format_exceptions that was producing blank exception pages when an inheriting template is present [ticket:71]
diff --git a/CHANGES b/CHANGES index 53bf334..c1a2fb8 100644 --- a/CHANGES +++ b/CHANGES
@@ -8,6 +8,9 @@ - fixed lexer exceptions not cleaning up temporary files, which could lead to a maximum number of file descriptors used in the process [ticket:69] +- fixed issue with inline format_exceptions that was producing + blank exception pages when an inheriting template is + present [ticket:71] 0.1.10 - fixed propagation of 'caller' such that nested %def calls
diff --git a/lib/mako/runtime.py b/lib/mako/runtime.py index 865e99c..8917b73 100644 --- a/lib/mako/runtime.py +++ b/lib/mako/runtime.py
@@ -329,7 +329,7 @@ if not result: raise error else: - context._buffer_stack = [util.StringIO()] + context._buffer_stack[:] = [util.FastEncodingBuffer()] error_template = exceptions.html_error_template() context._with_template = error_template error_template.render_context(context, error=error)
diff --git a/test/exceptions_.py b/test/exceptions_.py index 1ed4f33..6fa3682 100644 --- a/test/exceptions_.py +++ b/test/exceptions_.py
@@ -4,6 +4,8 @@ from mako import exceptions from mako.template import Template +from mako.lookup import TemplateLookup +from util import result_lines class ExceptionsTest(unittest.TestCase): def test_html_error_template(self): @@ -57,6 +59,20 @@ else: assert False, ("This function should trigger a CompileException, " "but didn't") - + + def test_format_exceptions(self): + l = TemplateLookup(format_exceptions=True) + + l.put_string("foo.html", """ +<%inherit file="base.html"/> +${foobar} + """) + + l.put_string("base.html", """ + ${self.body()} + """) + + assert '<div class="sourceline">${foobar}</div>' in result_lines(l.get_template("foo.html").render()) + if __name__ == '__main__': unittest.main()