#17664: Smart `if` tag silences exceptions
-------------------------------------+-------------------------------------
     Reporter:  mrmachine            |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Template system      |                  Version:  master
     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 mrmachine):

 If we are going to silence exceptions the same way as template variable
 resolution, do we need special handling for filters that may be applied to
 the variable after it is resolved?

 The docs say:

     Since the template language doesn’t provide exception handling, any
 exception raised from a template filter will be exposed as a server error.
 Thus, filter functions should avoid raising exceptions if there is a
 reasonable fallback value to return. In case of input that represents a
 clear bug in a template, raising an exception may still be better than
 silent failure which hides the bug.

 So for the following code:

 {{{
 {% if not foo.bar|filter_that_raises_AttributeError %}
 }}}

 I would expect to see a 500 response.

 But for:

 {{{
 {% if not foo.bar_raises_AttributeError %}
 }}}

 I would not...?

--
Ticket URL: <https://code.djangoproject.com/ticket/17664#comment:15>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.cfee2292b3a84d5c3b8ca42b0037babe%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to