On Wed, 2008-09-17 at 16:29 -0700, zvoase wrote: > Yeah, that's it, process_exception is *definitely* what I need :) > But as for the idea, how do you feel about it?
It's trying to use exceptions for regular flow control instead of very exceptional cases. That's neither particularly Lisp-ish nor Pythonic. :-) My experience has been that scattering output-specific information, like the actual HttpResponse and content over multiple functions tends to backfire. It tends to be more robust to pass around proper Python objects that encapsulate the "what" not the "how" and turn it into "how it shall be displayed to the user" at the last moment. For example, if you need to also include a JSON output style in addition to XML, you have to change 57 different functions, instead of just the couple of places that might be otherwise responsible for the converting from output-format agnostic Python objects to the particular output format. Still, if it suits your style, I think the middleware approach is sound. But it doesn't need to go into core and, for the reasons above, I wouldn't particularly be in favour because it doesn't encourage a particularly robust programming style. There are lots of little stylistic variations people have in their code and that's great because we should all use whatever makes things fastest for our own particular needs (taking into account the needs of the people we now or will work with, of course). However, we can't include "just a few lines" for each one in Django, since that rapidly becomes a lot of extra lines of code to maintain and they're so easy to manage externally and take only a few minutes to write the first time. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---