#22232: Template extends tag can cause recursion
---------------------------------+--------------------------------------
     Reporter:  galedragon       |                    Owner:  Saidin7979
         Type:  Bug              |                   Status:  assigned
    Component:  Template system  |                  Version:  1.6
     Severity:  Normal           |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  1                |                    UI/UX:  0
---------------------------------+--------------------------------------

Comment (by russellm):

 Hrm. This is an interesting problem. On the one hand, it would be nice to
 raise a humane error message, but if it's only going to catch the one-
 level recursion case, I'm starting to wonder if it's worth the effort.
 Adding a potentially expensive check to the top of every template load so
 that you can present a nicer error message in the edge case of recursive
 templates seems like too high a price to pay.

 If we can't find an efficient way to catch the complex circular case, I'm
 inclined to turn this into a documentation fix (ie. noting in the
 discussion around extends that circular loops may cause stack overflow
 errors).

 One option might be to handle this at render time, rather than at load
 time. If you put something in the context that tracks which templates have
 been used, and you try to re-use a template name, that indicates a
 circular loop, and you can raise an error. This should be relatively cheap
 (a set lookup & insertion on each new template file used); as long as we
 can find a clean place to track the data, it might suffice as a solution.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22232#comment:4>
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/068.5e1efea335d3a2aaae0f7cefb3f4c4a0%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to