diff --git a/django/template/engine.py b/django/template/engine.py index c377dbbc83..600c74ee24 100644 --- a/django/template/engine.py +++ b/django/template/engine.py @@ -7,7 +7,7 @@ from django.utils.functional import cached_property from django.utils import lru_cache from .base import Context, Template, TemplateDoesNotExist -from .loaders.utils import _get_template_loaders +from .loaders.utils import get_template_loaders _dirs_undefined = object() @@ -54,7 +54,7 @@ class Engine(object): @cached_property def template_loaders(self): - return _get_template_loaders(self.loaders) + return get_template_loaders(self.loaders) def find_template(self, name, dirs=None): # Inner import to avoid circular dependency diff --git a/django/template/loaders/cached.py b/django/template/loaders/cached.py index cf9a62b831..925abbe31f 100644 --- a/django/template/loaders/cached.py +++ b/django/template/loaders/cached.py @@ -9,7 +9,7 @@ from django.template.loader import get_template_from_string, make_origin from django.utils.encoding import force_bytes from .base import Loader as BaseLoader -from .utils import _get_template_loaders +from .utils import get_template_loaders class Loader(BaseLoader): @@ -20,7 +20,7 @@ class Loader(BaseLoader): self.find_template_cache = {} # Use the private, non-caching version of get_template_loaders # in case loaders isn't hashable. - self.loaders = _get_template_loaders(loaders) + self.loaders = get_template_loaders(loaders) def cache_key(self, template_name, template_dirs): if template_dirs: diff --git a/django/template/loaders/utils.py b/django/template/loaders/utils.py index a49b3ecfde..8b742f89fd 100644 --- a/django/template/loaders/utils.py +++ b/django/template/loaders/utils.py @@ -1,25 +1,17 @@ import warnings -from django.conf import settings from django.core.exceptions import ImproperlyConfigured -from django.utils import lru_cache from django.utils import six from django.utils.module_loading import import_string -@lru_cache.lru_cache() -def get_template_loaders(): - return _get_template_loaders(settings.TEMPLATE_LOADERS) - - -def _get_template_loaders(template_loaders=None): +def get_template_loaders(template_loaders): loaders = [] for template_loader in template_loaders: loader = find_template_loader(template_loader) if loader is not None: loaders.append(loader) - # Immutable return value because it will be cached and shared by callers. - return tuple(loaders) + return loaders def find_template_loader(loader):