Re: Cycle & Include tags

2011-03-08 Thread Russell Keith-Magee
On Tue, Mar 8, 2011 at 9:29 PM, Russell Keith-Magee
 wrote:
> On Tue, Mar 8, 2011 at 11:29 AM, Brian Neal  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 %}
>> 
>> {% 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.



Re: Cycle & Include tags

2011-03-08 Thread Russell Keith-Magee
On Tue, Mar 8, 2011 at 11:29 AM, Brian Neal  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 %}
> 
> {% 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.

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.



Cycle & Include tags

2011-03-07 Thread Brian Neal
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 %}

{% 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.

Thanks!

-- 
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.