From 4ad856d0d854d4d0fab7841f2161e14b9026d6d7 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Thu, 2 Apr 2015 15:52:26 +0100 Subject: [PATCH] Fixes to render_modal_workflow - RequestContext is deprecated - Fixed mutable dict as a default parameter --- wagtail/wagtailadmin/modal_workflow.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/wagtail/wagtailadmin/modal_workflow.py b/wagtail/wagtailadmin/modal_workflow.py index 998dfdec3..ac46d5d12 100644 --- a/wagtail/wagtailadmin/modal_workflow.py +++ b/wagtail/wagtailadmin/modal_workflow.py @@ -1,24 +1,22 @@ import json from django.http import HttpResponse -from django.template import RequestContext from django.template.loader import render_to_string -def render_modal_workflow(request, html_template, js_template, template_vars={}): +def render_modal_workflow(request, html_template, js_template, template_vars=None): """" Render a response consisting of an HTML chunk and a JS onload chunk in the format required by the modal-workflow framework. """ response_keyvars = [] - context = RequestContext(request) if html_template: - html = render_to_string(html_template, template_vars, context) + html = render_to_string(html_template, template_vars or {}, request=request) response_keyvars.append("'html': %s" % json.dumps(html)) if js_template: - js = render_to_string(js_template, template_vars, context) + js = render_to_string(js_template, template_vars or {}, request=request) response_keyvars.append("'onload': %s" % js) response_text = "{%s}" % ','.join(response_keyvars)