[Django] #24877: Exceptions in renderizable responses are not handled by Middleware's `process_exception()`

38 views
Skip to first unread message

Django

unread,
May 29, 2015, 3:03:49 PM5/29/15
to django-...@googlegroups.com
#24877: Exceptions in renderizable responses are not handled by Middleware's
`process_exception()`
-------------------------------+--------------------
Reporter: Kronuz | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
If a response which has `render()` method raises an exception, the
exception is not handled by the middleware's `process_exception()` method.

Probably there's a missing try/except in
https://github.com/django/django/blob/master/django/core/handlers/base.py#L176,
like the one in #L145.

--
Ticket URL: <https://code.djangoproject.com/ticket/24877>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 29, 2015, 4:07:54 PM5/29/15
to django-...@googlegroups.com
#24877: Exceptions in renderizable responses are not handled by Middleware's
`process_exception()`
-------------------------------+--------------------------------------

Reporter: Kronuz | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Kronuz):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

As timograham said in the IRC, the docs say `process_exception()` will be
called if the view raises an exception, so it seems a bit ambiguous if
that includes deferred template rendering or not.

As the response object could be a response object of any type (just with a
render method), it'd be a nice enhancement if it also checked for
exceptions being thrown there to be handled by the middlewares.

--
Ticket URL: <https://code.djangoproject.com/ticket/24877#comment:1>

Django

unread,
May 29, 2015, 9:32:34 PM5/29/15
to django-...@googlegroups.com
#24877: Exceptions in renderizable responses are not handled by Middleware's
`process_exception()`
-------------------------------+------------------------------------
Reporter: Kronuz | Owner: nobody
Type: New feature | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* component: Uncategorized => HTTP handling
* version: 1.8 => master
* type: Uncategorized => New feature
* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/24877#comment:2>

Django

unread,
Jun 5, 2015, 7:42:39 AM6/5/15
to django-...@googlegroups.com
#24877: Exceptions in renderizable responses are not handled by Middleware's
`process_exception()`
-------------------------------+------------------------------------
Reporter: Kronuz | Owner: sephii
Type: New feature | Status: assigned

Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by sephii):

* status: new => assigned
* owner: nobody => sephii


--
Ticket URL: <https://code.djangoproject.com/ticket/24877#comment:3>

Django

unread,
Jun 6, 2015, 11:36:17 AM6/6/15
to django-...@googlegroups.com
#24877: Exceptions in renderizable responses are not handled by Middleware's
`process_exception()`
-------------------------------+------------------------------------
Reporter: Kronuz | Owner: sephii
Type: New feature | Status: assigned
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* has_patch: 0 => 1


Comment:

[https://github.com/django/django/pull/4805 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/24877#comment:4>

Django

unread,
Jun 11, 2015, 3:24:22 PM6/11/15
to django-...@googlegroups.com
#24877: Exceptions in renderizable responses are not handled by Middleware's
`process_exception()`
-------------------------------+------------------------------------
Reporter: Kronuz | Owner: sephii
Type: New feature | Status: assigned
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 0 => 1


Comment:

Comments for improvement on the PR.

--
Ticket URL: <https://code.djangoproject.com/ticket/24877#comment:5>

Django

unread,
Jul 2, 2015, 6:15:21 PM7/2/15
to django-...@googlegroups.com
#24877: Exceptions in renderizable responses are not handled by Middleware's
`process_exception()`
-------------------------------+------------------------------------
Reporter: Kronuz | Owner: sephii
Type: New feature | Status: assigned
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timgraham):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/24877#comment:6>

Django

unread,
Jul 3, 2015, 12:07:52 PM7/3/15
to django-...@googlegroups.com
#24877: Exceptions in renderizable responses are not handled by Middleware's
`process_exception()`
-------------------------------+------------------------------------
Reporter: Kronuz | Owner: sephii
Type: New feature | Status: closed

Component: HTTP handling | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"f5d5867a4a6aeddd58ff855a01ab4e438d938ac1" f5d5867a]:
{{{
#!CommitTicketReference repository=""
revision="f5d5867a4a6aeddd58ff855a01ab4e438d938ac1"
Fixed #24877 -- Added middleware handling of response.render() errors.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24877#comment:7>

Reply all
Reply to author
Forward
0 new messages