Preserve order of STATICFILES_DIRS locations in FileSystemFinder.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15389 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5cd5612808
commit
3bff7ed34c
|
@ -42,10 +42,10 @@ class FileSystemFinder(BaseFinder):
|
||||||
to locate files.
|
to locate files.
|
||||||
"""
|
"""
|
||||||
def __init__(self, apps=None, *args, **kwargs):
|
def __init__(self, apps=None, *args, **kwargs):
|
||||||
|
# List of locations with static files
|
||||||
|
self.locations = []
|
||||||
# Maps dir paths to an appropriate storage instance
|
# Maps dir paths to an appropriate storage instance
|
||||||
self.storages = SortedDict()
|
self.storages = SortedDict()
|
||||||
# Set of locations with static files
|
|
||||||
self.locations = set()
|
|
||||||
if not isinstance(settings.STATICFILES_DIRS, (list, tuple)):
|
if not isinstance(settings.STATICFILES_DIRS, (list, tuple)):
|
||||||
raise ImproperlyConfigured(
|
raise ImproperlyConfigured(
|
||||||
"Your STATICFILES_DIRS setting is not a tuple or list; "
|
"Your STATICFILES_DIRS setting is not a tuple or list; "
|
||||||
|
@ -59,13 +59,12 @@ class FileSystemFinder(BaseFinder):
|
||||||
raise ImproperlyConfigured(
|
raise ImproperlyConfigured(
|
||||||
"The STATICFILES_DIRS setting should "
|
"The STATICFILES_DIRS setting should "
|
||||||
"not contain the STATIC_ROOT setting")
|
"not contain the STATIC_ROOT setting")
|
||||||
self.locations.add((prefix, root))
|
if (prefix, root) not in self.locations:
|
||||||
# Don't initialize multiple storages for the same location
|
self.locations.append((prefix, root))
|
||||||
for prefix, root in self.locations:
|
for prefix, root in self.locations:
|
||||||
filesystem_storage = FileSystemStorage(location=root)
|
filesystem_storage = FileSystemStorage(location=root)
|
||||||
filesystem_storage.prefix = prefix
|
filesystem_storage.prefix = prefix
|
||||||
self.storages[root] = filesystem_storage
|
self.storages[root] = filesystem_storage
|
||||||
|
|
||||||
super(FileSystemFinder, self).__init__(*args, **kwargs)
|
super(FileSystemFinder, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
def find(self, path, all=False):
|
def find(self, path, all=False):
|
||||||
|
|
Loading…
Reference in New Issue