Commit fa226cd7 authored by Aymeric Augustin's avatar Aymeric Augustin
Browse files

Fixed #17303 -- Ensured the list of template loaders is fully loaded before it...

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
parent ca984aa5
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -19,8 +19,12 @@ class Loader(BaseLoader):
    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):