#19541: Reversing URLs in response middleware or streamed responses won't use 
per-
request urlconf
-------------------------------+-------------------------------------
     Reporter:  aaugustin      |                    Owner:  aaugustin
         Type:  Bug            |                   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
-------------------------------+-------------------------------------

Comment (by aaugustin):

 The URLconf is set to `settings.ROOT_URLCONF` at the beginning of every
 request:
 
https://github.com/django/django/blob/1e4a27d08790c96f657d2e960c8142d1ca69aede/django/core/handlers/base.py#L80

 And it's set to `None` at the end of every request:
 
https://github.com/django/django/blob/1e4a27d08790c96f657d2e960c8142d1ca69aede/django/core/handlers/base.py#L179

 (The `try` and the `finally` clauses highlighted in these two links go
 together.)

 ----

 I think Django should just stop resetting the URLconf at the end of every
 request:
 - it'll be reset at the very beginning of the next request anyway (even
 before request middleware runs),
 - this code was part of the original commit (6c61ca3d) and not introduced
 to fix a bug,
 - it does cause bugs for streaming responses,
 - the rationale given in the comment is rather weak.

 So, I'd like to remove this `try/finally` block — and deindent the 100
 lines inside. I'm not attaching a patch because the deindent would cause
 too much noise.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19541#comment:7>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to