[Web-SIG] httpy -- raise Response(409)
Jonathan Ellis
jonathan at carnageblender.com
Mon Feb 27 19:08:34 CET 2006
On Mon, 27 Feb 2006 12:07:52 -0500, "Chad Whitacre" <chad at zetaweb.com>
said:
> From conversations this weekend (briefly with Jim; also with Guido) it
> seems that the most controversial aspect of httpy's API is the use of
> raise for flow control. I wonder if you all wouldn't mind helping me get
> to the bottom of this issue?
I agree with the general sentiment that raise/except to pass Response
objects around feels clunky.
> I think the trick is that in HTTP, success and error conditions both
> produce the same result: a Response message. In Python we distinguish
> the two: successful "requests" (i.e., function calls) return something;
> bad requests raise something.
If the source of your unease is the handler returning both "success" and
"error" responses itself, I'm more comfortable with the abstraction of a
handler raising some NotFoundError, for instance, and translating that
into a 404 response farther up the stack.
(Spyce takes this approach because centralizing exception handling like
this makes it easy to allow the user to plug in a custom function to
handle
them if necessary.)
-Jonathan
--
C++ is history repeated as tragedy. Java is history repeated as farce. --Scott McKay
More information about the Web-SIG
mailing list