On 04/12/10 09:15, Tim Diggins wrote:
View& template: look for a handle{{status_code}} variable, falling back to handle_exception. The generic handle_exception in non-DEBUG looks for a specific "{{status_code}}.html" template, but falls back to a (say) "http_exception.html" template. (there would be a very basic implementation of this template supplied with django).
So, I'm not sure I like making this the responsibility of the view (especially errors that happen where there is no view, such as the URL 404s). I prefer a cleaner separation. Still, the idea of one thing handling everything is useful (see Russ' post).
Debug: In DEBUG==True, I'm not sure how important it is to allow the view handlers differently per status_code (other than 404), but you could do a similar lookup (technical_{{status_code}}_response) with 500 as the fallback. This strikes me as fairly expressive and not too magical, while being quite lightweight, and (bonus) wouldn't require any deprecation.
No deprecation is always a plus, but I _do_ want to see the back of some of the current parts of the error handling system. Then again, it might be best to wait till the long-in-the-future "Django 2", if and when such a thing happens.
(Sorry, I know you asked for crit, and I gave an alternative... It's not that I thought that your plan was __wrong__, just that it was a little heavier than needed). Specific crit: I'm not keen on the HttpNotFound rename of Http404 -- Http404 is so easy to remember (and type) and somehow more expressive (it stands out from surrounding code as being quite different, which in fact it is).
Fair enough - I just wanted consistent naming, and the response types are already HttpResponseSomeName. We could always just call them Http409 or something, but I see that as less readable (not everyone immediately knows 409 is a conflict, for example).
Andrew -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.