Ticket #17303: 17303.diff

File 17303.diff, 1012 bytes (added by Anssi Kääriäinen, 13 years ago)
  • django/template/loaders/cached.py

    diff --git a/django/template/loaders/cached.py b/django/template/loaders/cached.py
    index 3ed9cf3..702d6b6 100644
    a b class Loader(BaseLoader):  
    1919    def loaders(self):
    2020        # Resolve loaders on demand to avoid circular imports
    2121        if not self._cached_loaders:
     22            # Note that it is important to set the self._cached_loaders only
     23            # after all the self._loaders have been added to the list.
     24            # Otherwise concurrent access to this property could see
     25            # half-loaded _cached_loaders list. See #17303 for details.
     26            cached_loaders = []
    2227            for loader in self._loaders:
    23                 self._cached_loaders.append(find_template_loader(loader))
     28                cached_loaders.append(find_template_loader(loader))
     29            self._cached_loaders = cached_loaders
    2430        return self._cached_loaders
    2531
    2632    def find_template(self, name, dirs=None):
Back to Top