Use repr instead of str for getting context data via the system render function, so it works better for non-ASCII data.

This commit is contained in:
Ned Batchelder
2013-06-10 12:57:39 -04:00
parent 979ee6844e
commit a841bf7d2e

View File

@@ -33,8 +33,8 @@ def test_system():
"""
Construct a test ModuleSystem instance.
By default, the render_template() method simply returns the context it is
passed as a string. You can override this behavior by monkey patching::
By default, the render_template() method simply returns the repr of the
context it is passed. You can override this behavior by monkey patching::
system = test_system()
system.render_template = my_render_func
@@ -46,7 +46,7 @@ def test_system():
ajax_url='courses/course_id/modx/a_location',
track_function=Mock(),
get_module=Mock(),
render_template=lambda template, context: str(context),
render_template=lambda template, context: repr(context),
replace_urls=lambda html: str(html),
user=Mock(is_staff=False),
filestore=Mock(),