﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7815	Let Context handle include, extends and inclusion_tag template loading	Johannes Dollinger	nobody	" * 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'])))
}}}


"		closed	Template system	dev		wontfix	feature	goliath.mailinglist@… research@…	Design decision needed	0	1	1	0	0	0
