Commit a6cf2b10 by Chris Jerdonek

Merge 'issue_65' into development: addition for issue #65

The Renderer class's default loader now inherits the decode_errors
attribute for the instance.
parents 201249d8 a49fa8cb
......@@ -55,7 +55,8 @@ class Renderer(object):
the method should either return None (as dict.get() does) or
raise an exception.
Defaults to constructing a Loader instance with
default_encoding passed as the encoding argument.
default_encoding and decode_errors passed as the encoding and
decode_errors arguments, respectively.
output_encoding: the encoding to use when rendering to a string.
The argument should be the name of an encoding as a string, for
......@@ -93,7 +94,7 @@ class Renderer(object):
escape = markupsafe.escape if markupsafe else cgi.escape
if loader is None:
loader = Loader(encoding=default_encoding)
loader = Loader(encoding=default_encoding, decode_errors=decode_errors)
literal = markupsafe.Markup if markupsafe else unicode
......
......@@ -43,6 +43,17 @@ class RendererInitTestCase(unittest.TestCase):
# Check all attributes for good measure.
self.assertEquals(actual.__dict__, expected.__dict__)
def test_loader__default__decode_errors(self):
"""Test that the default loader inherits the decode_errors."""
r = Renderer(decode_errors='foo')
actual = r.loader
expected = Loader(decode_errors='foo')
self.assertEquals(actual.decode_errors, expected.decode_errors)
# Check all attributes for good measure.
self.assertEquals(actual.__dict__, expected.__dict__)
class RendererTestCase(unittest.TestCase):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment