mirror of
https://github.com/django/django.git
synced 2025-05-05 06:27:31 +00:00
Removed unused API get_template_loaders.
It was introduced in a recent refactoring so this isn't an issue. Then renamed _get_template_loaders to get_template_loaders.
This commit is contained in:
parent
572cdb4391
commit
544a716da8
@ -7,7 +7,7 @@ from django.utils.functional import cached_property
|
|||||||
from django.utils import lru_cache
|
from django.utils import lru_cache
|
||||||
|
|
||||||
from .base import Context, Template, TemplateDoesNotExist
|
from .base import Context, Template, TemplateDoesNotExist
|
||||||
from .loaders.utils import _get_template_loaders
|
from .loaders.utils import get_template_loaders
|
||||||
|
|
||||||
|
|
||||||
_dirs_undefined = object()
|
_dirs_undefined = object()
|
||||||
@ -54,7 +54,7 @@ class Engine(object):
|
|||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def template_loaders(self):
|
def template_loaders(self):
|
||||||
return _get_template_loaders(self.loaders)
|
return get_template_loaders(self.loaders)
|
||||||
|
|
||||||
def find_template(self, name, dirs=None):
|
def find_template(self, name, dirs=None):
|
||||||
# Inner import to avoid circular dependency
|
# Inner import to avoid circular dependency
|
||||||
|
@ -9,7 +9,7 @@ from django.template.loader import get_template_from_string, make_origin
|
|||||||
from django.utils.encoding import force_bytes
|
from django.utils.encoding import force_bytes
|
||||||
|
|
||||||
from .base import Loader as BaseLoader
|
from .base import Loader as BaseLoader
|
||||||
from .utils import _get_template_loaders
|
from .utils import get_template_loaders
|
||||||
|
|
||||||
|
|
||||||
class Loader(BaseLoader):
|
class Loader(BaseLoader):
|
||||||
@ -20,7 +20,7 @@ class Loader(BaseLoader):
|
|||||||
self.find_template_cache = {}
|
self.find_template_cache = {}
|
||||||
# Use the private, non-caching version of get_template_loaders
|
# Use the private, non-caching version of get_template_loaders
|
||||||
# in case loaders isn't hashable.
|
# 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):
|
def cache_key(self, template_name, template_dirs):
|
||||||
if template_dirs:
|
if template_dirs:
|
||||||
|
@ -1,25 +1,17 @@
|
|||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.utils import lru_cache
|
|
||||||
from django.utils import six
|
from django.utils import six
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
|
|
||||||
|
|
||||||
@lru_cache.lru_cache()
|
def get_template_loaders(template_loaders):
|
||||||
def get_template_loaders():
|
|
||||||
return _get_template_loaders(settings.TEMPLATE_LOADERS)
|
|
||||||
|
|
||||||
|
|
||||||
def _get_template_loaders(template_loaders=None):
|
|
||||||
loaders = []
|
loaders = []
|
||||||
for template_loader in template_loaders:
|
for template_loader in template_loaders:
|
||||||
loader = find_template_loader(template_loader)
|
loader = find_template_loader(template_loader)
|
||||||
if loader is not None:
|
if loader is not None:
|
||||||
loaders.append(loader)
|
loaders.append(loader)
|
||||||
# Immutable return value because it will be cached and shared by callers.
|
return loaders
|
||||||
return tuple(loaders)
|
|
||||||
|
|
||||||
|
|
||||||
def find_template_loader(loader):
|
def find_template_loader(loader):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user