Dear devels,
    I use the Http404 exception a *lot*, mainly because I call a lot
of functions from within my views (I was raised in the Lisp tradition
of refactoring EVERYTHING into separate functions) and it's nice
sometimes to override the caller and just return a set response to the
client. But the thing is, I do a lot of REST work, and I'm a stickler
for keeping to the HTTP standard, so sometimes I need to return a lot
of other HTTP status codes to the client, and at the moment I have to
explicitly capture everything I call from within my view and then
return that.
Anyway, my request for comment (RFC) is this: wouldn't it be nice to
have an exception which you can instantiate with a response, raise,
and then any call to a view function which results in the raising of
this exception would return the response? This would be implemented by
having some middleware which just sat on top of the view function,
checking to see if this error (i.e. 'ResponseException') was raised.
If it was, then the response which it held (which would be in its
'response' attribute) would be returned.
It sounds a little hard to digest, so I'm working on an example which
I'll post soon. For the meantime, take a look at http://dpaste.com/hold/78671/
for a sample implementation. You could probably see how it would all
work just from that.

Regards,
Zack
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to