Malformed expressions render in ginger where Jinja2 raises a TypeError.
Reproduction
| template |
Jinja2 |
ginger |
{{[1()]}} |
TypeError: 'int' object is not callable |
empty (ok) |
{{ attr is divisibleby }} |
TypeError: test_divisibleby() missing 1 required positional argument: 'num' |
empty (ok) |
{{ o is sameas }} |
TypeError: test_sameas() missing 1 required positional argument: 'other' |
empty (ok) |
Calls on other non-callables ('tuple' object is not callable), builtin tests called with extra arguments, and len/round on scalars behave the same way.
Root cause
Calls on non-callable values return null, and builtin tests and filters evaluate with missing or wrongly typed arguments instead of raising an error (the builtin dispatch in src/Text/Ginger/Run.hs and src/Text/Ginger/Run/Builtins.hs applied to GVal values).
Malformed expressions render in ginger where Jinja2 raises a
TypeError.Reproduction
{{[1()]}}TypeError: 'int' object is not callable{{ attr is divisibleby }}TypeError: test_divisibleby() missing 1 required positional argument: 'num'{{ o is sameas }}TypeError: test_sameas() missing 1 required positional argument: 'other'Calls on other non-callables (
'tuple' object is not callable), builtin tests called with extra arguments, andlen/roundon scalars behave the same way.Root cause
Calls on non-callable values return null, and builtin tests and filters evaluate with missing or wrongly typed arguments instead of raising an error (the builtin dispatch in
src/Text/Ginger/Run.hsandsrc/Text/Ginger/Run/Builtins.hsapplied toGValvalues).