Fixed #17303 -- Ensured the list of template loaders is fully loaded before it is cached. Thanks andrey DOT gtx AT gmail DOT com for the report and patch, and Anssi Kääriäinen for the review.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17295 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ca984aa50a
commit
fa226cd740
|
@ -19,8 +19,12 @@ class Loader(BaseLoader):
|
||||||
def loaders(self):
|
def loaders(self):
|
||||||
# Resolve loaders on demand to avoid circular imports
|
# Resolve loaders on demand to avoid circular imports
|
||||||
if not self._cached_loaders:
|
if not self._cached_loaders:
|
||||||
|
# Set self._cached_loaders atomically. Otherwise, another thread
|
||||||
|
# could see an incomplete list. See #17303.
|
||||||
|
cached_loaders = []
|
||||||
for loader in self._loaders:
|
for loader in self._loaders:
|
||||||
self._cached_loaders.append(find_template_loader(loader))
|
cached_loaders.append(find_template_loader(loader))
|
||||||
|
self._cached_loaders = cached_loaders
|
||||||
return self._cached_loaders
|
return self._cached_loaders
|
||||||
|
|
||||||
def find_template(self, name, dirs=None):
|
def find_template(self, name, dirs=None):
|
||||||
|
|
Loading…
Reference in New Issue