Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Here's the rest of [9530] where I actually rename the tag like I said…

… I did. I swear this was git's fault, not mine.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9532 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit bd2b0059beeaf3cf4eddac38364e039bc91410fe 1 parent 714490b
@jacobian jacobian authored
View
10 django/template/defaulttags.py
@@ -679,14 +679,14 @@ def do_for(parser, token):
" %s" % token.contents)
sequence = parser.compile_filter(bits[in_index+1])
- nodelist_loop = parser.parse(('default', 'endfor',))
+ nodelist_loop = parser.parse(('empty', 'endfor',))
token = parser.next_token()
- if token.contents == 'default':
- nodelist_default = parser.parse(('endfor',))
+ if token.contents == 'empty':
+ nodelist_empty = parser.parse(('endfor',))
parser.delete_first_token()
else:
- nodelist_default = None
- return ForNode(loopvars, sequence, is_reversed, nodelist_loop, nodelist_default)
+ nodelist_empty = None
+ return ForNode(loopvars, sequence, is_reversed, nodelist_loop, nodelist_empty)
do_for = register.tag("for", do_for)
def do_ifequal(parser, token, negate):
View
6 tests/regressiontests/templates/tests.py
@@ -484,9 +484,9 @@ def get_template_tests(self):
'for-tag-unpack11': ("{% for x,y,z in items %}{{ x }}:{{ y }},{{ z }}/{% endfor %}", {"items": (('one', 1), ('two', 2))}, ("one:1,/two:2,/", "one:1,INVALID/two:2,INVALID/")),
'for-tag-unpack12': ("{% for x,y,z in items %}{{ x }}:{{ y }},{{ z }}/{% endfor %}", {"items": (('one', 1, 'carrot'), ('two', 2))}, ("one:1,carrot/two:2,/", "one:1,carrot/two:2,INVALID/")),
'for-tag-unpack13': ("{% for x,y,z in items %}{{ x }}:{{ y }},{{ z }}/{% endfor %}", {"items": (('one', 1, 'carrot'), ('two', 2, 'cheese'))}, ("one:1,carrot/two:2,cheese/", "one:1,carrot/two:2,cheese/")),
- 'for-tag-default01': ("{% for val in values %}{{ val }}{% default %}default text{% endfor %}", {"values": [1, 2, 3]}, "123"),
- 'for-tag-default02': ("{% for val in values %}{{ val }}{% default %}values array empty{% endfor %}", {"values": []}, "values array empty"),
- 'for-tag-default03': ("{% for val in values %}{{ val }}{% default %}values array not found{% endfor %}", {}, "values array not found"),
+ 'for-tag-empty01': ("{% for val in values %}{{ val }}{% empty %}empty text{% endfor %}", {"values": [1, 2, 3]}, "123"),
+ 'for-tag-empty02': ("{% for val in values %}{{ val }}{% empty %}values array empty{% endfor %}", {"values": []}, "values array empty"),
+ 'for-tag-empty03': ("{% for val in values %}{{ val }}{% empty %}values array not found{% endfor %}", {}, "values array not found"),
### IF TAG ################################################################
'if-tag01': ("{% if foo %}yes{% else %}no{% endif %}", {"foo": True}, "yes"),
Please sign in to comment.
Something went wrong with that request. Please try again.