We should store the template path, not the template object, as the key
in our testing cache
This commit is contained in:
parent
99619a625b
commit
67e8c45d2a
@ -94,7 +94,7 @@ def get_jinja_env(template_loader, locale):
|
|||||||
TEMPLATE_TEST_CONTEXT = {}
|
TEMPLATE_TEST_CONTEXT = {}
|
||||||
|
|
||||||
|
|
||||||
def render_template(request, template, context):
|
def render_template(request, template_path, context):
|
||||||
"""
|
"""
|
||||||
Render a template with context.
|
Render a template with context.
|
||||||
|
|
||||||
@ -102,12 +102,12 @@ def render_template(request, template, context):
|
|||||||
Also stores the context if we're doing unit tests. Helpful!
|
Also stores the context if we're doing unit tests. Helpful!
|
||||||
"""
|
"""
|
||||||
template = request.template_env.get_template(
|
template = request.template_env.get_template(
|
||||||
template)
|
template_path)
|
||||||
context['request'] = request
|
context['request'] = request
|
||||||
rendered = template.render(context)
|
rendered = template.render(context)
|
||||||
|
|
||||||
if TESTS_ENABLED:
|
if TESTS_ENABLED:
|
||||||
TEMPLATE_TEST_CONTEXT[template] = context
|
TEMPLATE_TEST_CONTEXT[template_path] = context
|
||||||
|
|
||||||
return rendered
|
return rendered
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user