[Web-SIG] httpy -- raise Response(409)

Robert Brewer fumanchu at amor.org
Tue Mar 7 00:31:04 CET 2006


Chad Whitacre wrote:
> 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.
> 
> So perhaps the answer is that respond(request) may *either* 
> return *or* raise a Response?

This is the approach CherryPy takes. You can raise HTTPRedirect (for 3xx
responses) or HTTPError (for 4xx-5xx responses); however, 2xx responses
are usually performed with a normal "return". By far, the biggest issue
with this approach is educating users: not every *exception* is an
*error*.


Robert Brewer
System Architect
Amor Ministries
fumanchu at amor.org


More information about the Web-SIG mailing list