#3544: Fix {% include %} to allow recursive includes
---------------------------------------------------------+------------------
Reporter: David Danier <[EMAIL PROTECTED]> | Owner: adrian
Status: new |
Component: Template system
Version: SVN |
Resolution:
Keywords: |
Stage: Design decision needed
Has_patch: 1 |
Needs_docs: 1
Needs_tests: 1 |
Needs_better_patch: 1
---------------------------------------------------------+------------------
Comment (by David Danier <[EMAIL PROTECTED]>):
Thats appropriate. The submitted code is not really intended to be a
patch, I would call it "solution code example", but this cannot be
selected when submitting tickets. ;-)
(As a side-effect it shows how such a cache could be used to merge the two
Include-classes)
Besides the example has one drawback I didn't think of when writing it:
The cache will survive multiple requests. If you change the template it
will not get loaded again. "Fixed" this by clearing the cache on the
"request_finished" and "got_request_exception"-signal.
If someone wants to use it, even though it's a hack (perhaps as a
workaround, like I do):
{{{
from django.core import signals
from django.dispatch import dispatcher
def clear_template_include_cache():
RecursiveIncludeNode.cache = {}
dispatcher.connect(clear_template_include_cache,
signal=signals.request_finished)
dispatcher.connect(clear_template_include_cache,
signal=signals.got_request_exception)
}}}
As I'm not into the template-code I'm sure there is some better way to
implement this.
--
Ticket URL: <http://code.djangoproject.com/ticket/3544#comment:2>
Django Code <http://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 post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---