﻿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
17093	Refactor django.template to quarantine global state	Carl Meyer	Aymeric Augustin	"The template engine keeps a lot of global state around: the instantiated template loaders, the list of builtins, the cached list of loaded templatetag modules. This makes it inflexible for use as a library (you can't render different templates using different template loaders or directories or tag modules in the same process) and makes test isolation very difficult (for the same reasons).

This can be fixed via a refactoring to introduce a `TemplateEngine` class to encapsulate all this state. We would still create a default module-level instance of `TemplateEngine` based on the settings, and backwards-compatibility wrappers for the current public API that delegate to the default engine. But this would then allow alternative instances of TemplateEngine to be created and used for library use and testing, that would be self-contained and independent from settings.

In the long run, this type of refactoring is also necessary if we want to move towards ""app-object"" style configuration in place of global settings."	Cleanup/optimization	closed	Template system	dev	Normal	fixed		bradley.ayers@… waylan@… techtonik@… kmike84@… tgecho yac	Accepted	1	0	0	0	0	0
