...if in debug mode, and a suspicious operation is raised, the following
code gets executed:
{{{
if settings.DEBUG:
return debug.technical_500_response(request,
*sys.exc_info(), status_code=400)
}}}
...this causes the technical_500_response() function to throw a further
exception because it's not expecting a "status_code" keyword argument.
Though I appreciate that SuspiciousOperation shouldn't really be thrown by
user code (only by Django in production in relation to ALLOWED_HOSTS
issues -- the code that uncovered this has since been modified), the error
still needs addressing, whether in the code above, or amending in
technical_debug_response() to accept status_code as a keyword argument.
--
Ticket URL: <https://code.djangoproject.com/ticket/24868>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Hi,
Can you show an example of code that triggers the invalid kwarg error?
From what I can tell, `technical_500_response` does take a `status_code`
argument:
https://github.com/django/django/blob/stable/1.8.x/django/views/debug.py#L87
Thanks.
--
Ticket URL: <https://code.djangoproject.com/ticket/24868#comment:1>
* status: new => closed
* resolution: => invalid
--
Ticket URL: <https://code.djangoproject.com/ticket/24868#comment:2>
Comment (by andrewhayes1979):
This actually turned out to be an issue in django-extensions, something
called null_technical_500_response()...needs patching there for Django
1.8+.
My bad.
--
Ticket URL: <https://code.djangoproject.com/ticket/24868#comment:3>