Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit fa226cd740f1349383d5e8399dc8a5255b70f07a 1 parent ca984aa
@aaugustin aaugustin authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 django/template/loaders/cached.py
View
6 django/template/loaders/cached.py
@@ -19,8 +19,12 @@ def __init__(self, loaders):
def loaders(self):
# Resolve loaders on demand to avoid circular imports
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:
- self._cached_loaders.append(find_template_loader(loader))
+ cached_loaders.append(find_template_loader(loader))
+ self._cached_loaders = cached_loaders
return self._cached_loaders
def find_template(self, name, dirs=None):
Please sign in to comment.
Something went wrong with that request. Please try again.