You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm migrating a former Copier (Jinja2) template into Nunjucks. So far I have focused on the following conditionals:
src/
{% if values.include_deployment %}main.py{% endif %}
{% if values.include_deployment %}pipeline.py{% endif %}
{% if not values.include_deployment %}pipeline.py{% endif %}
All the issues I have found while debugging this simple use case:
Without modifying the code above, this example outcomes the following error: EISDIR: illegal operation on a directory, open '/tmp/0eb043fb-1a7a-4c8c-b226-8b5fd818a662/src'
If the not is deleted and values.include_deployment == true, then templating this snippet works as expected
If the not is deleted and values.include_deployment == false, then templating this snippet fails with: Error: EISDIR: illegal operation on a directory, open '/tmp/f9cd3cf9-b493-4af4-8f9a-8101ba5c3fb3/src'
If I add the not to the three conditionals and values.include_deployment == false, then templating this snippet works as expected
If I delete the not and use ... == false the error is the same (EISDIR)
If I change the not for ! it complains about the later being an unrecognized token
Based on your FAQs this should not be a compatibility issue between Jinja2 and Nunjucks. This syntax is the same in both Python and Javascript and, honestly, this is one of the most basic functionalities you expect in a templating engine. What's happening here?
The text was updated successfully, but these errors were encountered:
guillemrbaiges
changed the title
Conditional syntaxes FAIL(?!) if condition is False
Conditional syntaxes cause an ERROR(?!) if condition is False
Oct 26, 2022
I'm migrating a former Copier (Jinja2) template into Nunjucks. So far I have focused on the following conditionals:
All the issues I have found while debugging this simple use case:
EISDIR: illegal operation on a directory, open '/tmp/0eb043fb-1a7a-4c8c-b226-8b5fd818a662/src'
not
is deleted andvalues.include_deployment
== true, then templating this snippet works as expectednot
is deleted andvalues.include_deployment
== false, then templating this snippet fails with:Error: EISDIR: illegal operation on a directory, open '/tmp/f9cd3cf9-b493-4af4-8f9a-8101ba5c3fb3/src'
not
to the three conditionals andvalues.include_deployment
== false, then templating this snippet works as expectednot
and use... == false
the error is the same (EISDIR)not
for!
it complains about the later being an unrecognized tokenBased on your FAQs this should not be a compatibility issue between Jinja2 and Nunjucks. This syntax is the same in both Python and Javascript and, honestly, this is one of the most basic functionalities you expect in a templating engine. What's happening here?
The text was updated successfully, but these errors were encountered: