Re: RFC: Raise an Exception to return a Response

2008-09-17 Thread zvoase
Thanks a lot, I understand what you're saying completely. I was thinking more along the lines of errors which can occur which wouldn't necessarily warrant 404s, but that's probably only a niche - mainly for things like REST and places where a client really does care what status code is returned. A

Re: RFC: Raise an Exception to return a Response

2008-09-17 Thread Malcolm Tredinnick
On Wed, 2008-09-17 at 16:29 -0700, zvoase wrote: > Yeah, that's it, process_exception is *definitely* what I need :) > But as for the idea, how do you feel about it? It's trying to use exceptions for regular flow control instead of very exceptional cases. That's neither particularly Lisp-ish nor

Re: RFC: Raise an Exception to return a Response

2008-09-17 Thread zvoase
That's true. That doesn't mean, however, that the ResponseException class should be removed; it's useful in that you don't need to go like this: exc = Exception() exc.response = HttpResponse('content', ...) raise exc You can just do it all in one line. It could be put in 'django.core.e

Re: RFC: Raise an Exception to return a Response

2008-09-17 Thread Jeremy Dunck
On Wed, Sep 17, 2008 at 6:30 PM, zvoase <[EMAIL PROTECTED]> wrote: > > Sorry, here: http://dpaste.com/hold/78774/ > > On Sep 18, 1:29 am, zvoase <[EMAIL PROTECTED]> wrote: >> Yeah, that's it, process_exception is *definitely* what I need :) >> But as for the idea, how do you feel about it? >> By t

Re: RFC: Raise an Exception to return a Response

2008-09-17 Thread zvoase
Sorry, here: http://dpaste.com/hold/78774/ On Sep 18, 1:29 am, zvoase <[EMAIL PROTECTED]> wrote: > Yeah, that's it, process_exception is *definitely* what I need :) > But as for the idea, how do you feel about it? > By the way, I've just posted a better version of it (sorry for my > temporary lac

Re: RFC: Raise an Exception to return a Response

2008-09-17 Thread zvoase
Yeah, that's it, process_exception is *definitely* what I need :) But as for the idea, how do you feel about it? By the way, I've just posted a better version of it (sorry for my temporary lack of brain) here: http://dpaste.com/hold/78773/ On Sep 17, 9:26 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wr

Re: RFC: Raise an Exception to return a Response

2008-09-17 Thread Jeremy Dunck
On Wed, Sep 17, 2008 at 12:11 PM, zvoase <[EMAIL PROTECTED]> wrote: ... > I'll post soon. For the meantime, take a look at http://dpaste.com/hold/78671/ That won't do what you want, since the "raise" on line 13 will prevent line 14 from executing. I agree, you seem to want process_exception. --

Re: RFC: Raise an Exception to return a Response

2008-09-17 Thread Collin Grady
Wouldn't it be easier to use process_exception instead of process_view ? -- Collin Grady --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develo

RFC: Raise an Exception to return a Response

2008-09-17 Thread zvoase
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. Bu