For example:
a view yields a 308 Code which will be an instance of a plain
`HttpResponse` object instead of a subclass of `HttpResponseRedirectBase`,
thus it does not have a `url` attribute with the url the response is
redirecting to.
I will hand in a patch soon.
--
Ticket URL: <https://code.djangoproject.com/ticket/31430>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Jacob Stöhr
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/31430#comment:1>
Comment (by Jacob Stöhr):
While trying to fix this bug, I encountered something else which I filed
under https://code.djangoproject.com/ticket/31432 . Fixing that ticket
would render this ticket obsolete, therefore I will not produce a patch
for this ticket yet.
--
Ticket URL: <https://code.djangoproject.com/ticket/31430#comment:2>
* status: assigned => closed
* resolution: => invalid
* component: Uncategorized => Testing framework
Comment:
`test.Client` supports 307 and 308 redirects (see #27999). You should
return `HttpResponseRedirect(redirect_to, status=308)`.
--
Ticket URL: <https://code.djangoproject.com/ticket/31430#comment:3>
Comment (by Jacob Stöhr):
Thank you for your speedy response!
I have now been debugging my issue for another ~2 hours (and I havent seen
your mail until just now), turns out this was not django's fault (of
course) but a commit no other than myself made 8 months ago that caused
the problem in our project.
I foolishly returned a bare `HttpResponse(status=308)` and overwrote the
`Location` to force a redirect. This of course failed in the
`_handle_redirects` method of the testclient because the `status_code` was
in `redirect_status_codes` but the response was not based on
`HttpResponseRedirectBase` and did thus not have the `url` property.
Your suggestion is of course correct, I will fix it in our project. Thank
you very much :)
--
Ticket URL: <https://code.djangoproject.com/ticket/31430#comment:4>