On Tue, Mar 8, 2011 at 9:29 PM, Russell Keith-Magee <russ...@keith-magee.com> wrote: > On Tue, Mar 8, 2011 at 11:29 AM, Brian Neal <bgn...@gmail.com> wrote: >> I'm using a recent checkout of Django trunk. >> >> If I have a template "test.html" which is this: >> >> {{ rowcolors }} >> >> the only way I could make cycle and include behave together is to do >> this: >> >> {% for obj in page.object_list %} >> <!-- {% cycle 'odd' 'even' as rowcolors %} --> >> {% include 'test.html' %} >> {% endfor %} >> >> I thought that perhaps the new "silent" keyword would eliminate the >> need to HTML comment out the cycle tag: >> >> {% for obj in page.object_list %} >> {% cycle 'odd' 'even' as rowcolors silent %} >> {% include 'test.html' %} >> {% endfor %} >> >> However, the very first time through the for loop, rowcolors is not >> set in the included template. It works on subsequent cycles though. >> >> Is there a way to make this work without having to HTML comment out >> the cycle tag output? Admittedly it's a minor annoyance. > > It looks like you may have discovered a problem with the silent flag > as designed. The use you present is exactly what the silent flag was > designed to address; but it appears that it doesn't actually hit that > use case. > > I've just opened #15570 to track this problem, and since this is a new > feature (which will require a backwards incompatible change to fix), > it is a blocker for 1.3 final. The fix will be to make silent *always* > put the value into context, but not render a value. This is the usage > that your second sample suggests as appropriate usage.
... and, FYI: Fixed in r15773. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.