| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
subproperty
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In Python, it's legal to use splats in function calls like this:
call_function('123', *b, c=5, **d)
Prior to this change, jinja2 did not allow that. It mandated that all
splatting had to take place at the end of the call:
call_function('123', c=5, *b, **d)
This commit allows both orders.
Additionally, this commit adds tests for more things that are illegal:
namely giving a function a positional argument after using a splat to
unpack positional arguments or giving a function a named argument after
using a double splat to unpack keyword arguments.
|
|
|
|
|
| |
- e.g {% set foo | trim %}...{% endset %}
- closes #486
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
This avoids deep nesting in case of many `{% elif .. %}` blocks (which
would fail during execution) and also deep recursion (which may fail
during compilation)
fixes #759
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently we skip an extra comma when "with context" is not provided to
the "from" statement. This allows invalid code such as this:
{% from "functions.html" import my_function,, %}
The primary issue with this is that it is not consistent when providing
"with context". The following code throws an error, contrary to the
previous example:
{% from "functions.html" import my_function,, with context %}
It seems that the comma skipping was originally found in 0611e49 and was
accidentally put inside the "with context" check in ea847c5. It was then
updated to use "skip_if" in fdf9530.
There doesn't seem to be any reason for this check existing, as
double commas should never be allowed and serve no purpose in the
statement.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently token parsing on "from ... import ..." is rather "loose" — it
sees the following "invalid" code as perfectly valid:
{% from "functions" import my_function, %}
{% from "functions" import, %}
{% from "functions" import %}
This is caused by the parser ignoring non-name values where there should
be names, either as the first value or after commas.
This commit ensures only name values are allowed as the first value and
any values after commas in the import section.
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
(replacing unicode with six.text_type, but not replacing u"" by six.u(""))
|
| |
|
| |
|
|
|
|
|
|
| |
Statements like "-foo.bar" had their implicit parentheses applied around
the first part of the expression ("(-foo).bar") instead of the more
correct "-(foo.bar)".
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
|
|
|
| |
This change makes ``{% if %}...{% endif %}`` a syntax error
now. (#364)
--HG--
branch : trunk
|
|
|
|
|
|
| |
--HG--
branch : trunk
extra : rebase_source : d8f677273490fa73d5603b68478fa3b54f60ccb9
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
|
|
|
| |
as an alias to `foo not in bar` like in python. Previously the grammar
required parentheses (`not (foo in bar)`) which was odd.
--HG--
branch : trunk
|
|
|
|
|
|
|
| |
support jython
--HG--
branch : trunk
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
|
|
| |
non existing templates.
--HG--
branch : trunk
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
|
|
| |
volatile `__len__` like the listreverseiterator. `else` in inline if-expressions is optional now.
--HG--
branch : trunk
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
|
|
| |
put into parentheses for chaning.
--HG--
branch : trunk
|
|
|
|
|
|
|
| |
the priority. foo.bar checks foo.bar first and then foo['bar'] and the other way round.
--HG--
branch : trunk
|
|
|
|
|
|
|
| |
and true in the template are the same now, same for false/False and none/None.
--HG--
branch : trunk
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
| |
--HG--
branch : trunk
|
|
|
|
|
|
|
| |
and context as first arguments. This slows calls down a bit but is a lot more user friendly. Added first draft of FAQ
--HG--
branch : trunk
|