Mark with targets as parameters
This fixes a bug where the targets of a `{% with %}` block would not
be marked as a parameter. This is because they were not being marked
at all as a variable which results in an invalid AST. For reference
counting purposes, this must also be marked specifically as a parameter
variable instead of as a stored variable to ensure it does not leak
out of the block.
This commit is contained in:
parent
6116df58b6
commit
90f036a934
@ -197,7 +197,7 @@ def parse_block_with(ast):
|
||||
if 'key' not in parameter:
|
||||
raise
|
||||
|
||||
targets.append(parameter['key'])
|
||||
targets.append(nodes.Name(parameter['key'], 'param'))
|
||||
values.append(parse_variable(parameter['value']))
|
||||
|
||||
with_node.targets = targets
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
{% from 'forms.html' import input as input_field, textarea %}
|
||||
{{ dict_var['single']["double"].dot |test("first" ,2_000, named=3.14)|filter | lastFilter}}
|
||||
{%with key=val %}
|
||||
test {{var}}
|
||||
{%endwith%}
|
||||
{% with a='', b=a.attribute %}...{% endwith %}
|
||||
{% for item in dict_var.values() %}
|
||||
<li>{% block loop_item %}{{ item }}{% endblock %}</li>
|
||||
{% endfor %}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user