On Wed, Aug 12, 2009 at 8:03 AM, Russell Keith-Magee <freakboy3...@gmail.com
> wrote:

>
> On Wed, Aug 12, 2009 at 9:45 AM, SmileyChris<smileych...@gmail.com> wrote:
> >
> > http://code.djangoproject.com/ticket/11461
> >
> > DebugNodeList catches all exceptions, sticks them in a
> > TemplateSyntaxError, and stuffs the original exception in the new
> > exception. I'm not sure why this is done, but it breaks debugging and
> > exception handling.
> >
> > What is the advantage of swallowing the exceptions?
>
> I can't speak with authority on the reason behind this, but if I had
> to guess, I would say this might be a case of confusing intention with
> accident. This behaviour has existed for at least as long as I can
> remember, and it's been annoying for pretty much all of that time.
>
> To me, this points to a design decision that made sense in the early
> days (pre-magic removal; maybe even pre public release). That decision
> may have made sense with an earlier version of Django that didn't have
> as much potential for exceptions in templates, but it is clearly
> problematic now.
>

For whatever it's worth, the origin of this code is nearly four year ago on
the new-admin branch:

http://code.djangoproject.com/changeset/1046

>From the commit message there the intent was clearly to help, not hinder,
template debugging.  Things were quite different then, there was a
TemplateDebugMiddlware added earlier on that branch:

http://code.djangoproject.com/changeset/947

(where DebugNodeList was originally introduced) responsible for highlighting
where the problems were for an exception.  Before this code got back to
trunk, the debug middleware was removed and special handling for template
exceptions was integrated into the "new error pages":

http://code.djangoproject.com/changeset/1299

That introduced get_template_exception_info, which we still have.

The template debug code did not get to trunk via a branch merge but rather
was individually moved over here:

http://code.djangoproject.com/changeset/1379

I'm not sure at what point reporting of the original exception traceback was
lost, but I thought I'd seen the details of the wrapped exception getting
reported on debug pages -- long after these code changes since they were
long before my time.  Does that not happen any more? Or does that only
happen some of the time?  My guess is losing the original traceback wasn't
an intentional thing.

Karen

--~--~---------~--~----~------------~-------~--~----~
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 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to