#17229: Allow 'True', 'False' and 'None' to resolve to corresponding Python 
objects
-------------------------------------+-------------------------------------
     Reporter:  anatoly techtonik    |                    Owner:  nobody
  <techtonik@…>                      |                   Status:  reopened
         Type:  New feature          |                  Version:  1.2
    Component:  Template system      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Design
     Keywords:                       |  decision needed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by lukeplant):

 * needs_docs:  1 => 0
 * ui_ux:  1 => 0
 * type:  Bug => New feature
 * stage:  Unreviewed => Design decision needed


Old 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.

New description:

 [Original bug title: Invalid '==' expression silently ignored leading to
 invalid result]

 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.

--

Comment:

 Your initial example only did a comparison to `True`, and didn't mention
 any comparison to `None`. I am not a mind reader!

 The ticket has now changed in scope to the feature addition "Allow 'True',
 'False' and 'None' to resolve to corresponding Python objects".

 I can see why this would be useful, but I'm not entirely convinced, given
 that we've survived without these for a long time. Therefore marking DDN.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17229#comment:5>
Django <https://code.djangoproject.com/>
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?hl=en.

Reply via email to