On Mon, Jul 8, 2013 at 10:01 AM, Jorge C. Leitão
<[email protected]> wrote:
> Django allows users to define handlers to some exceptions, most notably
> http404, server error (status 500) and permission denied (status 403).
>

In fact, django already allows you to install handlers to process any
kind of unhandled exception, by installing middleware with a
process_exception() method that handles exceptions of that type.

> I here propose this feature to be extended to HttpResponseNotAllowed (status
> 405).
>

This is a HttpResponse subclass, not an exception. handle404 does not
get involved if you return a HttpResponseNotFound response from your
view, only if you raise a http.Http404 exception. Basically:

Middleware can handle any unhandled exception before the other
exception handlers are involved.
handle403 handles uncaught django.core.exceptions.PermissionDenied exceptions.
handle404 handles uncaught django.http.Http404 exceptions.
handle500 handles all other uncaught exceptions.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to