#27783: VariableDoesNotExist can lead to stack overflows unusually easily
-------------------------------------------+------------------------
               Reporter:  Ryan O’Hara      |          Owner:  nobody
                   Type:  Bug              |         Status:  new
              Component:  Template system  |        Version:  1.10
               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                |
-------------------------------------------+------------------------
 If a form is overridden to render a template
 ([https://github.com/gregmuellegger/django-floppyforms django-floppyforms]
 does this):

 {{{
 class ExampleForm(forms.Form):
     def as_table(self):
         return render(None, 'example.html', {'form': self})
 }}}

 and the template refers to a nonexistent attribute on the form:

 {{{
 {{ form.boom }}
 }}}

 printing the `VariableDoesNotExist` will cause it to attempt to stringify
 the form for context again.

 Tentative patch changes it to always `repr()`, which seems appropriate and
 has the advantage of showing dict context like this:

 {{{
 Failed lookup for key [author] in {'section': '"News"'}
 }}}

 instead of like this:

 {{{
 Failed lookup for key [author] in '{\'section\': \'"News"\'}'
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27783>
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/058.978a12ef9c9701fbef60296e267e6471%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to