Re: raising HttpResponseBadRequest throws Exception Type error?

2008-07-06 Thread Rob Hudson
On Jul 5, 7:33 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > Having an exception > for every possible response code is really overkill here, since it means > you'll be raising status-code-related exceptions instead of more > semantic ones. Ah, makes sense. > > * Shouldn't Django be

Re: raising HttpResponseBadRequest throws Exception Type error?

2008-07-05 Thread Malcolm Tredinnick
On Sat, 2008-07-05 at 18:58 -0700, Rob Hudson wrote: [...] > * Shouldn't all HTTP error code raising function similarly? Shouldn't > I be able to raise a 400 error the same as a 404? Not really. Django has a 404 exception as a quick bail out for when something is missing and it and

raising HttpResponseBadRequest throws Exception Type error?

2008-07-05 Thread Rob Hudson
In my code for an API it made sense to me to import and raise `HttpResponseBadRequest ` when the API was given bad data to work with. I'm importing and raising the error like this: from django.http import Http404, HttpResponseBadRequest raise HttpResponseBadRequest, "Invalid data" But