]> git.ipfire.org Git - thirdparty/jinja.git/commit
Disallow f(x, y=1, z) and similar nonsense 405/head
authorThiefMaster <adrian@planetcoding.net>
Thu, 5 Feb 2015 23:34:36 +0000 (00:34 +0100)
committerThiefMAster <adrian@planetcoding.net>
Fri, 6 Feb 2015 17:18:07 +0000 (18:18 +0100)
commite41e76cd3318d7a689a14be1740a73e087242f0c
treed28ad856e6e0d3ef50be5e20811390b6caebf0cc
parentc6c6ea14375db6fb6a23a8bca533a6e388356422
Disallow f(x, y=1, z) and similar nonsense

Python rejects such function definitions because it doesn't make much
sense to have arguments with no default values after arguments with
default values.

Jinja did allow them, but handled them improperly (associating the
default value with the wrong argument).

Due to how broken the current behavior is, it makes more sense to reject
templates containing such defintions instead of trying to handle them
properly. Both cases are going to break existing code containing such
definitions, but besides the fact that possibly no such code exists it
is better to fail with a clear error than to silently change the values
of arguments.

This fixes #364
CHANGES
jinja2/parser.py
jinja2/testsuite/core_tags.py