#12250: process_view middleware prevents process_exception handling
-------------------------------------+-------------------------------------
Reporter: manfre | Owner: manfre
Type: Bug | Status: new
Component: Core (Other) | Version: master
Severity: Normal | Resolution:
Keywords: middleware | Triage Stage: Design
Has patch: 1 | decision needed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by akaariai):
Another similar issue exists in process_request(). Consider case:
{{{
MIDDLEWARE_CLASSES = [
'TransactionMiddleware',
'SavesToDB',
'RaisesException'
]
}}}
What happens is that TransactionMiddleware will open a transaction in
process_request, savestodb will save to db and then RaisesException will
raise an exception. The process_exceptions aren't called in this case.
Finally process_response is called for every of the middlewares and thus
TranscationMiddleware will commit the transaction. This is not good.
I see two solutions here - either we do the process_exception() dance for
all middlewares for which process_request has been called (in
process_view() case this means every middleware). Or, we decide that
process_* should not ever raise an exception, and we go to panic mode if
this happens. The panic mode would mean that we would try to release all
resources (close connections etc) and then return a barebone 500 response.
To me the panic mode doesn't seem like a good idea.
I reported this in #19648. I marked that ticket as a duplicate of this
one.
--
Ticket URL: <https://code.djangoproject.com/ticket/12250#comment:12>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit https://groups.google.com/groups/opt_out.