mirror of https://github.com/django/django.git
Refs #13408 -- Removed obsolete code/comments from {% for %} unpacking deprecation.
This commit is contained in:
parent
c6cd9f4ae2
commit
ba749f8f87
|
@ -189,10 +189,6 @@ class ForNode(Node):
|
||||||
if unpack:
|
if unpack:
|
||||||
# If there are multiple loop variables, unpack the item into
|
# If there are multiple loop variables, unpack the item into
|
||||||
# them.
|
# them.
|
||||||
|
|
||||||
# To complete this deprecation, remove from here to the
|
|
||||||
# try/except block as well as the try/except itself,
|
|
||||||
# leaving `unpacked_vars = ...` and the "else" statements.
|
|
||||||
if not isinstance(item, (list, tuple)):
|
if not isinstance(item, (list, tuple)):
|
||||||
len_item = 1
|
len_item = 1
|
||||||
else:
|
else:
|
||||||
|
@ -203,13 +199,9 @@ class ForNode(Node):
|
||||||
"Need {} values to unpack in for loop; got {}. "
|
"Need {} values to unpack in for loop; got {}. "
|
||||||
.format(num_loopvars, len_item),
|
.format(num_loopvars, len_item),
|
||||||
)
|
)
|
||||||
try:
|
unpacked_vars = dict(zip(self.loopvars, item))
|
||||||
unpacked_vars = dict(zip(self.loopvars, item))
|
pop_context = True
|
||||||
except TypeError:
|
context.update(unpacked_vars)
|
||||||
pass
|
|
||||||
else:
|
|
||||||
pop_context = True
|
|
||||||
context.update(unpacked_vars)
|
|
||||||
else:
|
else:
|
||||||
context[self.loopvars[0]] = item
|
context[self.loopvars[0]] = item
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue