#7815: Let Context handle include, extends and inclusion_tag template loading
-----------------------------+----------------------------------------------
Reporter: emulbreh | Owner: nobody
Status: new | Milestone:
Component: Template system | Version: SVN
Keywords: feature | Stage: Unreviewed
Has_patch: 0 |
-----------------------------+----------------------------------------------
* Add a `loader` kwarg to `Context` which should be something with a
`get_template(name)` function. Default would be `django.template.loader`.
* Provide `get_template()` and `select_template()` methods on `Context`,
use these in include, extends and inclusion_tag.
* Cache templates in `Context`, optionally: provide a way to populate
this cache.
* Remove `ConstantIncludeNode` since caching would provide the same
benefits and it causes problems with recursive includes.
This would fix
* #2949 - templating engine too tightly tied to TEMPLATE_DIRS in the
settings
* #3544 - recursive includes
* #4278 - get_template should accept a dirs argument
* #6834 - support for templates to be loaded from dynamically-selected
directories
Example:
{{{
#!python
class PrefixLoader:
def __init__(self, prefix_list):
self.prefix_list = prefix_list
def get_template(name):
from django.template.loader import select_template
return select_template(['%s/%s' % (prefix, name) for prefix in
self.prefix_list])
tpl.render(Context({}, loader=PrefixLoader(['a', 'b', 'c'])))
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/7815>
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
-~----------~----~----~----~------~----~------~--~---