#10216: TEMPLATE_DEBUG / TemplateSyntaxError handling doesn't play nice with Jinja2 -----------------------------+---------------------------------------------- Reporter: miracle2k | Owner: nobody Status: new | Milestone: Component: Template system | Version: SVN Keywords: | Stage: Unreviewed Has_patch: 0 | -----------------------------+---------------------------------------------- Django's error 500 page code in ''views/debug.py'' probes exceptions for a ''source'' attribute, and if it exists, expects it to contain a 2-tuple pointing to the location where the error occurred.
Jinja2's ''TemplateSyntaxError'' also features a ''source'' attribute, but it instead contains the source string of the template. As a result, when Jinja2 is used for templating and such an error occurs, Django breaks down while trying to build an error page for it. Instead, you get a simple WSGI strack trace for the new problem, rather than the actual template exception. The problem is this line: {{{ origin, (start, end) = self.exc_value.source }}} I would argue that Django assumption that the existence of an attribute named ''source'' implies a specific protocol is flawed. It should either check for a specific class (though there are appear to be multiple), or at least make sure that it ignores values it can't handle. -- Ticket URL: <http://code.djangoproject.com/ticket/10216> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---