Author: aaugustin
Date: 2011-12-30 04:55:08 -0800 (Fri, 30 Dec 2011)
New Revision: 17295

Modified:
   django/trunk/django/template/loaders/cached.py
Log:
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?\195?\164?\195?\164ri?\195?\164inen for the review.


Modified: django/trunk/django/template/loaders/cached.py
===================================================================
--- django/trunk/django/template/loaders/cached.py      2011-12-30 12:52:49 UTC 
(rev 17294)
+++ django/trunk/django/template/loaders/cached.py      2011-12-30 12:55:08 UTC 
(rev 17295)
@@ -19,8 +19,12 @@
     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):

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to