On Wed, Jan 02, 2008 at 04:09:43AM -0600, James Bennett wrote:
> 
> On Jan 2, 2008 3:49 AM, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> > 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?
> 
> No. Exceptions represent "errors" in a program, and the 4xx and 5xx
> status codes represent "errors" in HTTP, so that maps well. But 3xx
> status codes in HTTP are not errors, so implementing them as
> exceptions would feel awfully strange.

I disagree.  Exceptions represent "exceptional situations," not all of which are
necessarily errors.  For instance, SystemExit is not really an error, is it?
What about StopIteration?

The "error condition" semantics of exceptions are injected.

More practically, in Python, exceptions provide a simple way to trigger a major
state change in the application from a lower level in the call stack.  This is
frequently not an error.

A redirection exception seems natural to me; I've implemented something like
this myself in the past.

-Forest
-- 
Forest Bond
http://www.alittletooquiet.net

Attachment: signature.asc
Description: Digital signature

Reply via email to