Opened 7 years ago

Closed 5 years ago

#16444 closed Bug (duplicate)

reverse() doesn't respect request.urlconf when called from a generator passed to a response

Reported by: Jakub Roztočil Owned by: nobody
Component: Core (Other) Version: 1.3
Severity: Normal Keywords: urlconf, reverse
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When a middleware sets requests.urlconf and a view returns an HttpResponse with a generator as its content, then urls reverse()'d in the generator won't honor the URL Conf set by the middleware.

Here is a stripped-down example:

(Here is the view passing a generator:

Change History (2)

comment:1 Changed 7 years ago by Aymeric Augustin

Triage Stage: UnreviewedAccepted

The URLconf is reset here:

And this line runs after the view function returns, but before the response is evaluated, so before the generator is run.

comment:2 Changed 5 years ago by Aymeric Augustin

Resolution: duplicate
Status: newclosed

Duplicate of #19541 which contains more information.

Note: See TracTickets for help on using tickets.
Back to Top