pwt.jinja2js
pwt.jinja2js copied to clipboard
Unable to use loop.index with other jinja variables.
Hey, we love pwt.jinja2js. For some reason, the following template throws an error:
{% for item in lst %} {{ loop.index }} {{ item.name }} {% endfor %}
The following change fixes this issue: line 644 in jscompiler.py: if frame.forloop_buffer and node.node.name == "loop":
new line 644 in jscompiler.py: if frame.forloop_buffer and getattr(node.node, "name", None) == "loop":
I noticed that none of the tests attempt to use both the "loop" variables, and other variables within the same "for" tag. That might be why this never occurred before.
Ram