Commit e4bedf55 by Bridger Maxwell

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

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