Cleaned up the django.template namespace.

Since this package is going to hold both the implementation of the Django
Template Language and the infrastructure for Multiple Template Engines,
it should be untied from the DTL as much as possible within our
backwards-compatibility policy.

Only public APIs (i.e. APIs mentioned in the documentation) were left.
This commit is contained in:
Aymeric Augustin 2014-11-10 21:40:26 +01:00
parent bfa21ddf76
commit 7eefdbf7ab
11 changed files with 99 additions and 100 deletions

View file

@ -6,7 +6,7 @@ import functools
from django import template
from django.template import Library
from django.template.base import Context
from django.template.base import Context, libraries
from django.template.engine import Engine
from django.template.loader import get_template
from django.test.utils import override_settings
@ -100,9 +100,11 @@ def upper(value):
def register_test_tags(func):
@functools.wraps(func)
def inner(self):
template.libraries['testtags'] = register
func(self)
del template.libraries['testtags']
libraries['testtags'] = register
try:
func(self)
finally:
del libraries['testtags']
return inner