#15570: {% cycle ... as foo silent %} is broken in practice
-----------------------------------+------------------------------------
   Reporter:  russellm             |                    Owner:  nobody
     Status:  new                  |                Milestone:  1.3
  Component:  Template system      |                  Version:  1.3-beta
   Keywords:  blocker, regression  |             Triage Stage:  Accepted
  Has patch:  0                    |      Needs documentation:  0
Needs tests:  0                    |  Patch needs improvement:  0
-----------------------------------+------------------------------------
 r14439 introduced the 'silent' flag as a way to define a {% cycle %}
 without actually generating template content. This was done to address
 #13567.

 In addition to the use case given in the ticket, one of the reasons for
 introducing this flag was to support the use of cycles in included
 subtemplates; for example:
 {{{
 {% for obj in page.object_list %}
     {% cycle 'odd' 'even' as rowcolors %}
     {% include 'test.html' %}
 {% endfor %}
 }}}

 In this case, we want to define the cycle as part of the loop, but use the
 cycle value in the subtemplate. The subtemplate can't reference {% cycle
 rowcolors %} because the subtemplate parser doesn't have access to the
 parser context of the parent template. Therefore, the subtemplate needs to
 use {{ rowcolors }}.

 However, the implementation of the silent flag means that there is no way
 to define a cycle in the parent template and have it displayed in the
 included subtemplate *without* rendering it in the parent template. The
 current implementation only renders the tag silent on first usage, not
 subsequent uses.

 This should be addressed. 'silent' should render the cycle tag silent on
 every use; if you define a cycle as silent, you display the cycle value by
 rendering the variable to which it has been bound.

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

Reply via email to