#36243: Potential issue with the defaults.server_error method
--------------------------------+-----------------------------------------
Reporter: Bryant Glisson | Type: Bug
Status: new | Component: Uncategorized
Version: 4.2 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+-----------------------------------------
We have the following custom error method:
{{{
@requires_csrf_token
def server_500(request, template_name='views/500.html'):
return http.HttpResponseServerError(render(request, template_name))
}}}
This works fine, but for standardization purposes, I was going to change
the code to the following:
{{{
@requires_csrf_token
def server_500(request, template_name='views/500.html'):
return defaults.server_error(request, template_name)
}}}
This results in an infinite error loop. The issue is that our 500 template
draws on context that is included in context processors. When it is
accessed via the first method, the additional context we've provided via
these processors is included. When accessed via the default method, this
context is not included, resulting in errors, which in turn trigger
another 500 error.
I didn't know if this was expected behavior for this method or not, but I
wanted to bring it to your attention.
--
Ticket URL: <
https://code.djangoproject.com/ticket/36243>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.