#15034: Django's pretty error handling fails if there's a callable local var 
that
generates an exception in the stack trace.
---------------------------------------------------------+------------------
 Reporter:  mrmachine                                    |       Owner:  nobody 
   
   Status:  new                                          |   Milestone:  1.3    
   
Component:  Core framework                               |     Version:  SVN    
   
 Keywords:  debug template 500 error exception hijacked  |       Stage:  
Unreviewed
Has_patch:  0                                            |  
---------------------------------------------------------+------------------
 To reproduce, just add the following to any known working view:

 {{{
 from django.forms import BaseForm
 raise Exception
 }}}

 Instead of getting Django's pretty error handling, you will get a raw
 traceback in your browser that has nothing to do with the Exception you
 raised.

 The reason why is that `TECHNICAL_500_TEMPLATE` contains `{{
 var.1|pprint|force_escape }}` which triggers a call to
 `Variable().resolve()` which tries calling `var.1` (since it is callable)
 before passing it into the `pprint` filter.

 If `var.1` raises an exception when called, as `BaseForm` does (by design
 in this case as it's not meant to be called directly), the pretty error
 handling is hijacked and you have no idea what caused it.

 The fix is to call pprint() and force_escape() on each frame's local vars
 before passing them to the template as context.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/15034>
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-upda...@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.

Reply via email to