Marc Fargas wrote: > You could write an Exception middleware that takes care of processing > your "special" exception. Bu anyway, note that you are willing is to > give "response" so the right thing to do would be returning a response > object
The latter is not very convenient. Often the code that makes a decision about forbidding something is buried deep into model layer and can't easily return an HttpResponse. So I believe that making a special exception and converting it into an HttpResponseForbidden in a middleware is a good way to do this in current Django code. But I can really see the value of making it a part of Django even if just for the sake of consistency with Http404. BTW other HTTP errors in my practice don't work by this pattern so I don't propose making an exception for everything >= 400. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
