mirror of
https://github.com/django/django.git
synced 2025-10-27 15:46:10 +00:00
Deprecated SortedDict (replaced with collections.OrderedDict)
Thanks Loic Bistuer for the review.
This commit is contained in:
committed by
Tim Graham
parent
b278f7478d
commit
07876cf02b
@@ -1,8 +1,9 @@
|
||||
from collections import OrderedDict
|
||||
import os
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.core.files.storage import default_storage, Storage, FileSystemStorage
|
||||
from django.utils.datastructures import SortedDict
|
||||
from django.utils.functional import empty, memoize, LazyObject
|
||||
from django.utils.module_loading import import_by_path
|
||||
from django.utils._os import safe_join
|
||||
@@ -11,7 +12,7 @@ from django.utils import six
|
||||
from django.contrib.staticfiles import utils
|
||||
from django.contrib.staticfiles.storage import AppStaticStorage
|
||||
|
||||
_finders = SortedDict()
|
||||
_finders = OrderedDict()
|
||||
|
||||
|
||||
class BaseFinder(object):
|
||||
@@ -47,7 +48,7 @@ class FileSystemFinder(BaseFinder):
|
||||
# List of locations with static files
|
||||
self.locations = []
|
||||
# Maps dir paths to an appropriate storage instance
|
||||
self.storages = SortedDict()
|
||||
self.storages = OrderedDict()
|
||||
if not isinstance(settings.STATICFILES_DIRS, (list, tuple)):
|
||||
raise ImproperlyConfigured(
|
||||
"Your STATICFILES_DIRS setting is not a tuple or list; "
|
||||
@@ -118,7 +119,7 @@ class AppDirectoriesFinder(BaseFinder):
|
||||
# The list of apps that are handled
|
||||
self.apps = []
|
||||
# Mapping of app module paths to storage instances
|
||||
self.storages = SortedDict()
|
||||
self.storages = OrderedDict()
|
||||
if apps is None:
|
||||
apps = settings.INSTALLED_APPS
|
||||
for app in apps:
|
||||
|
||||
@@ -2,12 +2,12 @@ from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import sys
|
||||
from collections import OrderedDict
|
||||
from optparse import make_option
|
||||
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
from django.core.management.base import CommandError, NoArgsCommand
|
||||
from django.utils.encoding import smart_text
|
||||
from django.utils.datastructures import SortedDict
|
||||
from django.utils.six.moves import input
|
||||
|
||||
from django.contrib.staticfiles import finders, storage
|
||||
@@ -97,7 +97,7 @@ class Command(NoArgsCommand):
|
||||
else:
|
||||
handler = self.copy_file
|
||||
|
||||
found_files = SortedDict()
|
||||
found_files = OrderedDict()
|
||||
for finder in finders.get_finders():
|
||||
for path, storage in finder.list(self.ignore_patterns):
|
||||
# Prefix the relative path if the source storage contains it
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
from collections import OrderedDict
|
||||
import hashlib
|
||||
from importlib import import_module
|
||||
import os
|
||||
@@ -16,7 +17,6 @@ from django.core.cache import (get_cache, InvalidCacheBackendError,
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.core.files.base import ContentFile
|
||||
from django.core.files.storage import FileSystemStorage, get_storage_class
|
||||
from django.utils.datastructures import SortedDict
|
||||
from django.utils.encoding import force_bytes, force_text
|
||||
from django.utils.functional import LazyObject
|
||||
from django.utils._os import upath
|
||||
@@ -64,7 +64,7 @@ class CachedFilesMixin(object):
|
||||
except InvalidCacheBackendError:
|
||||
# Use the default backend
|
||||
self.cache = default_cache
|
||||
self._patterns = SortedDict()
|
||||
self._patterns = OrderedDict()
|
||||
for extension, patterns in self.patterns:
|
||||
for pattern in patterns:
|
||||
if isinstance(pattern, (tuple, list)):
|
||||
@@ -202,7 +202,7 @@ class CachedFilesMixin(object):
|
||||
|
||||
def post_process(self, paths, dry_run=False, **options):
|
||||
"""
|
||||
Post process the given SortedDict of files (called from collectstatic).
|
||||
Post process the given OrderedDict of files (called from collectstatic).
|
||||
|
||||
Processing is actually two separate operations:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user