#33134: Circular contexts when rendering Form with BoundFields.
----------------------------------+---------------------------------------
     Reporter:  Mariusz Felisiak  |                    Owner:  David Smith
         Type:  Bug               |                   Status:  assigned
    Component:  Forms             |                  Version:  4.0
     Severity:  Release blocker   |               Resolution:
     Keywords:                    |             Triage Stage:  Unreviewed
    Has patch:  1                 |      Needs documentation:  0
  Needs tests:  0                 |  Patch needs improvement:  1
Easy pickings:  0                 |                    UI/UX:  0
----------------------------------+---------------------------------------

Comment (by Keryn Knight):

 Replying to [comment:8 Matthias Kestenholz]:
 > I've looked into it and I'm unsure why django-debug-toolbar's test form
 calls `str()` inside `__repr__()`. I don't think this makes sense [...]

 Not to sidetrack the ticket too much, but I ''think'' the calling `str`
 within `__repr__` is precisely the point of the test, and indeed it's
 working as intended insofar as Mariusz has opened this ticket. Admitted,
 it's not ideal that the failure is just a stack overflow :) If any repr
 causes additional templates to run, ''and those templates themselves''
 have a context which includes reprs which need templates (ad infinitum),
 it'll eventually just  unavoidably explode.

 See https://github.com/jazzband/django-debug-toolbar/pull/1156 and
 https://github.com/jazzband/django-debug-toolbar/issues/1155  by way of
 https://github.com/wagtail/wagtail/issues/5243 for the history, such as it
 is. It happens that rendering a form's str in the repr is an easy way to
 encounter the problem (accidentally?), because `str` will render the form,
 with side-effects (SQL queries, additional template signals fired...) The
 problem being described in the latter, I think can be traced back to this
 ... https://github.com/jazzband/django-debug-toolbar/pull/933

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33134#comment:10>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/065.d0e488da1a86ae976f9c24c7458f4e4e%40djangoproject.com.

Reply via email to