Changeset 7752
- Timestamp:
- 06/25/08 23:30:06 (5 months ago)
- Files:
-
- django/trunk/django/template/defaulttags.py (modified) (1 diff)
- django/trunk/tests/regressiontests/templates/tests.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/trunk/django/template/defaulttags.py
r7557 r7752 163 163 self._last_seen = None 164 164 self._varlist = map(Variable, varlist) 165 166 def render(self, context): 167 if 'forloop' in context and context['forloop']['first']: 165 self._id = str(id(self)) 166 167 def render(self, context): 168 if 'forloop' in context and self._id not in context['forloop']: 168 169 self._last_seen = None 170 context['forloop'][self._id] = 1 169 171 try: 170 172 if self._varlist: django/trunk/tests/regressiontests/templates/tests.py
r7751 r7752 136 136 # Quickly check that we aren't accidentally using a name in both 137 137 # template and filter tests. 138 overlapping_names = [name for name in filter_tests if name in 139 template_tests] 138 overlapping_names = [name for name in filter_tests if name in template_tests] 140 139 assert not overlapping_names, 'Duplicate test name(s): %s' % ', '.join(overlapping_names) 141 140 … … 160 159 old_td, settings.TEMPLATE_DEBUG = settings.TEMPLATE_DEBUG, False 161 160 162 # Set TEMPLATE_STRING_IF_INVALID to a known string 161 # Set TEMPLATE_STRING_IF_INVALID to a known string. 163 162 old_invalid = settings.TEMPLATE_STRING_IF_INVALID 164 163 expected_invalid_str = 'INVALID' … … 550 549 'ifchanged06': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% for x in numx %}{% ifchanged %}{{ x }}{% endifchanged %}{% endfor %}{% endfor %}', {'num': (1, 1, 1), 'numx': (2, 2, 2)}, '1222'), 551 550 'ifchanged07': ('{% for n in num %}{% ifchanged %}{{ n }}{% endifchanged %}{% for x in numx %}{% ifchanged %}{{ x }}{% endifchanged %}{% for y in numy %}{% ifchanged %}{{ y }}{% endifchanged %}{% endfor %}{% endfor %}{% endfor %}', {'num': (1, 1, 1), 'numx': (2, 2, 2), 'numy': (3, 3, 3)}, '1233323332333'), 551 'ifchanged08': ('{% for data in datalist %}{% for c,d in data %}{% if c %}{% ifchanged %}{{ d }}{% endifchanged %}{% endif %}{% endfor %}{% endfor %}', {'datalist': [[(1, 'a'), (1, 'a'), (0, 'b'), (1, 'c')], [(0, 'a'), (1, 'c'), (1, 'd'), (1, 'd'), (0, 'e')]]}, 'accd'), 552 552 553 553 # Test one parameter given to ifchanged.
