#5831: Template Debug only highlights wrong {% for %} tag
--------------------------------------------+-------------------------------
Reporter:  Charmless <[EMAIL PROTECTED]>  |       Owner:  nobody                
    
  Status:  new                              |   Component:  Template system     
      
 Version:  SVN                              |    Keywords:  debug for toplevel 
nesting
   Stage:  Unreviewed                       |   Has_patch:  1                   
      
--------------------------------------------+-------------------------------
 When an exception happens within a for tag's head, the error source is
 assigned always assigned to the top-level for loop, even if the erroneous
 for tag is nested.

 Example:
 {{{
 {% for a in as %}
   {% for b in a.bs %}
     {% for c in b.relatedobject_set %}
        {{ c.foo }}
     {% endfor %}
   {% endfor %}
 {% endfor %}
 }}}

 The error here is at "b.relatedobject_set", which should be
 "b.relatedobject_set.all" (assuming b is a model related to a model
 releatedobject).

 As is, the template debug system marks the top level for tag, "{% for a in
 as %}", as being the point of error. The correct place to mark is the for
 tag where the error happened.

 Attached is a patch that fixes this. I'm not familiar with Django's tag
 tests, so I can't include any, but would be happy to learn and supply some
 if it is agreed that this is a correct fix.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5831>
Django Code <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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to