Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
Jacob Kaplan-Moss authored November 24, 2008
10  django/template/defaulttags.py
@@ -679,14 +679,14 @@ def do_for(parser, token):
679 679
                                       " %s" % token.contents)
680 680
 
681 681
     sequence = parser.compile_filter(bits[in_index+1])
682  
-    nodelist_loop = parser.parse(('default', 'endfor',))
  682
+    nodelist_loop = parser.parse(('empty', 'endfor',))
683 683
     token = parser.next_token()
684  
-    if token.contents == 'default':
685  
-        nodelist_default = parser.parse(('endfor',))
  684
+    if token.contents == 'empty':
  685
+        nodelist_empty = parser.parse(('endfor',))
686 686
         parser.delete_first_token()
687 687
     else:
688  
-        nodelist_default = None
689  
-    return ForNode(loopvars, sequence, is_reversed, nodelist_loop, nodelist_default)
  688
+        nodelist_empty = None
  689
+    return ForNode(loopvars, sequence, is_reversed, nodelist_loop, nodelist_empty)
690 690
 do_for = register.tag("for", do_for)
691 691
 
692 692
 def do_ifequal(parser, token, negate):
6  tests/regressiontests/templates/tests.py
@@ -484,9 +484,9 @@ def get_template_tests(self):
484 484
             '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/")),
485 485
             '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/")),
486 486
             '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/")),
487  
-            'for-tag-default01': ("{% for val in values %}{{ val }}{% default %}default text{% endfor %}", {"values": [1, 2, 3]}, "123"),
488  
-            'for-tag-default02': ("{% for val in values %}{{ val }}{% default %}values array empty{% endfor %}", {"values": []}, "values array empty"),
489  
-            'for-tag-default03': ("{% for val in values %}{{ val }}{% default %}values array not found{% endfor %}", {}, "values array not found"),
  487
+            'for-tag-empty01': ("{% for val in values %}{{ val }}{% empty %}empty text{% endfor %}", {"values": [1, 2, 3]}, "123"),
  488
+            'for-tag-empty02': ("{% for val in values %}{{ val }}{% empty %}values array empty{% endfor %}", {"values": []}, "values array empty"),
  489
+            'for-tag-empty03': ("{% for val in values %}{{ val }}{% empty %}values array not found{% endfor %}", {}, "values array not found"),
490 490
 
491 491
             ### IF TAG ################################################################
492 492
             'if-tag01': ("{% if foo %}yes{% else %}no{% endif %}", {"foo": True}, "yes"),

0 notes on commit bd2b005

Please sign in to comment.
Something went wrong with that request. Please try again.