Hi,

The HTTP return codes 404 and 500 can be raised with an exception.

That's very handy. Unfortunately a Http Redirect can't be raised.
Do other django users thing this would be usefull, too?

I implemented it myself. But I think something like this should be in django.

#responseutils.py
class HttpRedirectException(Exception):
    pass

# middleware.py
    def process_exception(self, request, exception):
        if isinstance(exception, responseutils.HttpRedirectException):
            return django.http.HttpResponseRedirect(exception.args[0])

# usage
    raise responseutils.HttpRedirectException(obj.get_absolute_url())

 Thomas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to