#2026: If statement doesn't allow for 'and' chaining.
-----------------------------+----------------------------------------------
Reporter: anonymous | Owner: adrian
Type: enhancement | Status: new
Priority: normal | Milestone:
Component: Template system | Version: SVN
Severity: normal | Keywords: if and or
-----------------------------+----------------------------------------------
It could be handy and provide better structure if `and` as well as `or`
chaining were allowed in an `if` statement.
`and` and `or` should mix, because it would be ambiguous, thus raising a
`TemplateSyntaxError`.
In this template:
{{{
{% if 1 and 1 %}good 1 and 1<br />{% endif %}
{% if 1 and 0 %}bad 1 and 0<br />{% endif %}
{% if 0 and 1 %}bad 0 and 1<br />{% endif %}
{% if 0 and 0 %}bad 0 and 0<br />{% endif %}
{% if 1 or 1 %}good 1 or 1<br />{% endif %}
{% if 1 or 0 %}good 1 or 0<br />{% endif %}
{% if 0 or 1 %}good 0 or 1<br />{% endif %}
{% if 0 or 0 %}bad 0 or 0<br />{% endif %}
}}}
should display:
{{{
good 1 and 1
good 1 or 1
good 1 or 0
good 0 or 1
}}}
and this template:
{{{
{% if 1 and 1 or 1 %}error 1 and 1 or 1<br />{% endif %}
}}}
should cause a `TemplateSyntaxError` (because `and` mixed with `or`).
--
Ticket URL: <http://code.djangoproject.com/ticket/2026>
Django <http://code.djangoproject.org/>
The web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---