]> git.ipfire.org Git - thirdparty/jinja.git/commit
Add support for namespaces in tuple assignment
authorKevin Brown-Silva <kevin@kevin-brown.com>
Mon, 2 May 2022 18:01:08 +0000 (12:01 -0600)
committerDavid Lord <davidism@gmail.com>
Fri, 20 Dec 2024 22:09:40 +0000 (14:09 -0800)
commitee832194cd9f55f75e5a51359b709d535efe957f
treeac3b42af3e39f82633c30320d9ca4d5c02eb088d
parent1d55cddbb28e433779511f28f13a2d8c4ec45826
Add support for namespaces in tuple assignment

This fixes a bug that existed because namespaces within `{% set %}`
were treated as a special case. This special case had the side-effect
of bypassing the code which allows for tuples to be assigned to.

The solution was to make tuple handling (and by extension, primary token
handling) aware of namespaces so that namespace tokens can be handled
appropriately. This is handled in a backwards-compatible way which
ensures that we do not try to parse namespace tokens when we otherwise
would be expecting to parse out name tokens with attributes.

Namespace instance checks are moved earlier, and deduplicated, so that
all checks are done before the assignment. Otherwise, the check could be
emitted in the middle of the tuple.
CHANGES.rst
docs/templates.rst
src/jinja2/compiler.py
src/jinja2/parser.py
tests/test_core_tags.py