Opened 16 years ago

Closed 16 years ago

#9521 closed (duplicate)

cycle templatetag is nondeterministic

Reported by: Grzegorz Lukasik Owned by: nobody
Component: Template system Version: 1.0
Severity: Keywords: cycle nondeterministic templatetag
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

It can bite you when for example you are coloring rows in your table in some pattern. After refresh you may get different coloring (if you use the sample compiled template, which is not true for default django template processing).

from django.template import Context, Template
t = Template("{% cycle 1 2 3 %}")
t.render(Context())

u'1'

t.render(Context())

u'2'

t.render(Context())

u'3'

t.render(Context())

u'1'

Change History (2)

comment:1 by Grzegorz Lukasik, 16 years ago

Formatted code:

>>> from django.template import Context, Template
>>> t = Template("{% cycle 1 2 3 %}")
>>> t.render(Context())
u'1'
>>> t.render(Context())
u'2'
>>> t.render(Context())
u'3'
>>> t.render(Context())
u'1'

comment:2 by anonymous, 16 years ago

Resolution: duplicate
Status: newclosed

duplicate of #7501

Note: See TracTickets for help on using tickets.
Back to Top