Hello everybody, I would love to propose a new solution for ticket #10216 which is currently a wontfix. Basically the problem is that with TEMPLATE_DEBUG turned on, Django expects a certain protocol from exceptions catched by the debugging system:
Either an exception does not have a .source attribute, or it has one and this is a tuple that can be unpacked where one of the items is an template loader origin and the second is the position in the template, as far as I can see that. Now the direct problem for me is that people get no proper debug output in Django if Jinja 2 raise an exception, because the .source attribute of a Jinja 2 exception has a different protocol: it's a string. Of course I can work around that problem in Jinja and tell people to disable TEMPLATE_DEBUG, but I think the issue is not limited to Jinja 2. The purpose of a debugging middleware is to show what went wrong. Currently the debugging middleware does the opposite if you have any exception with a source attribute that is not a template origin and position information. A quick search on google code showed me that .source is not an uncommon attribute on exceptions. For example PyXML uses it in the xpath for SyntaxException and internal exceptions. If any of these would be raised in a django application, the user would experience a broken debug view. Not sure how common PyQwt is in web applications but that would have the same problem ;) I would like to propose a different solution: do an instance check against a django TemplateSyntaxError (or any other template exception that has these .source attributes). That should be easy to accomplish and the debug system already has a dependency on the template engine anyways for the rendering of the UI. Regards, Armin -- 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.