#17664: {% if %} template tag silences exceptions inconsistently
-------------------------------------+-------------------------------------
     Reporter:  Tai Lee              |                    Owner:  (none)
         Type:  Bug                  |                   Status:  new
    Component:  Template system      |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:  smart if tag         |             Triage Stage:  Accepted
  queryset exception silenced        |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Lily Foote):

 Part of the problem here is that exceptions are swallowed in a counter-
 intuitive location. For example:

 {{{
 {% if missing|default:missing or True %}
 }}}

 I think most users would expect this to always evaluate as truthy.
 However, because the exception from the `default` filter is not caught
 immediately, it bubbles up to the `or` operator which catches it and
 returns `False`. If we added exception handling around the filter
 evaluation (like we have for variable evaluation), I think the behaviour
 would become much more intuitive.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/17664#comment:33>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/010701967154710c-37f6cad5-7d80-4e6e-aa32-671404fba010-000000%40eu-central-1.amazonses.com.

Reply via email to