#28172: Non-existent arg passed to template filter raises VariableDoesNotExist
(alternative solution)
-------------------------------------------+------------------------
               Reporter:  Vlastimil Zíma   |          Owner:  nobody
                   Type:  Bug              |         Status:  new
              Component:  Template system  |        Version:  master
               Severity:  Normal           |       Keywords:
           Triage Stage:  Unreviewed       |      Has patch:  0
    Needs documentation:  0                |    Needs tests:  0
Patch needs improvement:  0                |  Easy pickings:  0
                  UI/UX:  0                |
-------------------------------------------+------------------------
 I'd like to fix the error reported in #13167. The main bug

 {{{
 #!python
 from django.template import Context, Template
 Template('{{ foo|default:notreal }}').render(Context({'foo': ''}))
 }}}

 still raises `VariableDoesNotExist` exception, which is completely
 unexpected from templates, as noted in closing comment
 ticket:13167#comment:20. I took me more than an hour before I found out
 how did it make the server error I investigated.

 I know the original ticket was closed as wontfix, but I understood it was
 due to the effect the proposed change would have on `if` tag. But there's
 another way - capture the exception in `VariableNode` the similar way
 `UnicodeDecodeError` is silenced. If I understood the code correctly, that
 would solve the problem for all template filters, but left template tags
 intact.

--
Ticket URL: <https://code.djangoproject.com/ticket/28172>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/048.ffe2e0ea274f0bacaeb87d10d0ecbf3e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to