Page MenuHomePhabricator

error in comparison statement in jinja templates
Open, Needs TriagePublic

Description

After the following change 37d7308f2b890adaaab8226de38e20dc51c448e1
The following error arises when,
An example : {% if username != 'Guest' and username != False and username != None %} is changed
to {% if username != 'Guest' and username is not false and username is not none %}

Screenshot from 2020-03-13 18-54-24.png (907×1 px, 207 KB)

The change with none statement doesn't arises any problem, the issue is with the false statement

Event Timeline

@Sanyam.wikime, please also include instructions on how to reproduce the bug.

The possible fix is changing username is not false to username is not sameas false.

ref - https://jinja.palletsprojects.com/en/2.11.x/templates/

Can someone confirm the issue ?

@Gabrielchl Just update your local repo till the following commit 37d7308f2b890adaaab8226de38e20dc51c448e1 and go to 127.0.0.1:5000

The feature of false as a test was added in version 2.11.0 (https://jinja.palletsprojects.com/en/master/changelog/) (https://github.com/pallets/jinja/pull/824)
So should we add version conditions (like Jinja2>=2.11.0) to requirements.txt ?

Aklapper subscribed.

Removing task assignee due to inactivity as this open task has been assigned for more than two years. See the email sent to the task assignee on August 22nd, 2022.
Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome!
If this task has been resolved in the meantime, or should not be worked on ("declined"), please update its task status via "Add Action… 🡒 Change Status".
Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator. Thanks!