Skip to content

Commit

Permalink
Fix w.u.c.render_to_string with request=None
Browse files Browse the repository at this point in the history
When passed `request=None`, `wagtail.utils.compat.render_to_string`
would fail as it tried to construct a `RequestContext` without a
request.

Now, if `request=None,` no RequestContext is constructed, and no
`context_instance` is passed to `render_to_string`.
  • Loading branch information
mx-moth committed Nov 19, 2015
1 parent 57f3974 commit 660495b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wagtail/utils/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ def render_to_string(template_name, context=None, request=None, **kwargs):
return loader.render_to_string(
template_name,
dictionary=context,
context_instance=RequestContext(request),
context_instance=RequestContext(request) if request else None,
**kwargs
)

0 comments on commit 660495b

Please sign in to comment.