--
Ticket URL: <https://code.djangoproject.com/ticket/23783>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
can you add your use case please?
--
Ticket URL: <https://code.djangoproject.com/ticket/23783#comment:1>
Comment (by rednaw):
Regardless of the use case, your issue should be able to be solved like
this:
{{{
from django.core.urlresolvers import reverse
from django.http.response import HttpResponseRedirect
from django.utils.functional import SimpleLazyObject
def my_view(request):
SimpleLazyObject(lambda:
HttpResponseRedirect(reverse('core:frontpage')))
}}}
But unfortunately this doesn't work at the moment because `LazyObject`
(which `SimpleLazyObject` implements) doesn't implement `__iter__`. This
is required because the `BaseHandler` of `wsgiref` loops through response
objects, which invokes `__iter__`, but if since `LazyObject` doesn't
implement `__iter__` it falls back to `__getitem__` which won't work.
I opened an issue for this:
https://code.djangoproject.com/ticket/23838
I'll make a pull request for the `__iter__` method, when that will be
merged, the code snipped above will work.
--
Ticket URL: <https://code.djangoproject.com/ticket/23783#comment:2>
* cc: gitaarik@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/23783#comment:3>
* status: new => closed
* resolution: => needsinfo
Comment:
Closing as "needs info" in absence of a use case and/or confirmation that
the related ticket won't solve this.
--
Ticket URL: <https://code.djangoproject.com/ticket/23783#comment:4>