Opened 14 years ago
Last modified 14 years ago
#17229 closed New feature
Invalid '==' expression silently ignored leading to invalid result — at Initial Version
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Template system | Version: | 1.2 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
Let me clarify the title - I am not sure the expression below is invalid. It is the expression I intuitively expect to work. But perhaps Django it is a specifics of template language. In any case it should either complain or produce expected output, which it doesn't.
_{{ closed }}_
{% if closed == True %} ***** {% endif %}
If closed variable is equal to None, the example above will output the string:
_None_ *****
Expected is to output nothing or to give a warning about invalid right-side argument.
If closed is boolean (not string) and is equal to True, it will output
_True_
Expected is to output
_True_ *****
or to give a warning about invalid right-side argument.