Commit e4bedf55 by Bridger Maxwell

Bugfix to allow course.xml to be retrieved outside of request cycle (like Django shell).

parent 8d0e6581
......@@ -27,13 +27,15 @@ def render_to_string(template_name, dictionary, context=None, namespace='main'):
# collapse context_instance to a single dictionary for mako
context_dictionary = {}
context_instance['settings'] = settings
for d in mitxmako.middleware.requestcontext:
context_dictionary.update(d)
if mitxmako.middleware.requestcontext:
for d in mitxmako.middleware.requestcontext:
context_dictionary.update(d)
for d in context_instance:
context_dictionary.update(d)
if context:
context_dictionary.update(context)
# fetch and render template
print namespace, template_name
template = middleware.lookup[namespace].get_template(template_name)
return template.render(**context_dictionary)
......
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