Skip to content

Commit

Permalink
make render() fail early and loud, and landscape code checker happier…
Browse files Browse the repository at this point in the history
… by not accepting any unused arguments)
  • Loading branch information
florianm committed Oct 17, 2016
1 parent dab54f4 commit 0e94dd5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/adminactions/compat.py
Expand Up @@ -101,15 +101,17 @@ def model_has_field(model, field_name):

# Django 1.10 render() vs Django < 1.10 render_to_response()
if version < (1, 9):
def render(request, template, context=None, **kwargs):
def render(request, template, context=None):
"""A render() wrapper around render_to_response() for Django < 1.9.
There are more arguments to render() and render_to_response(),
and they are different across django versions.
As this wrapper is only ever used from within this package,
only request, template and context are handled, others are accepted
but will be discarded.
only request, template and context are handled.
Other args and kwargs are not accepted and will raise an Exception,
which will fail louder and earlier than accepting and silently
discarding them.
"""
return render_to_response(template, RequestContext(request, context))
else:
Expand Down

0 comments on commit 0e94dd5

Please sign in to comment.