diff options
| author | Claude Paroz <claude@2xlibre.net> | 2014-09-05 20:06:02 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2014-09-05 20:06:02 +0200 |
| commit | 885ff6845e54511022677c1f28b84ddd4f2165dd (patch) | |
| tree | fd3b2f1bcc32b69178a20b961b8ecffc71b8ab98 /django | |
| parent | 5d044339037be879a11b03fe8bd8c3ef1d520b1a (diff) | |
Revert "Fixed #23384 -- Allowed overriding part of a dictionary-type setting"
This reverts commit 66757fee7e921ad4c35e0b3f80c25e026100b31c.
Discussions have led to think that this functionality does not
bring significant benefits to justify the added complexity.
Read also discussions on ticket #22734.
Diffstat (limited to 'django')
| -rw-r--r-- | django/conf/__init__.py | 7 | ||||
| -rw-r--r-- | django/db/migrations/loader.py | 2 | ||||
| -rw-r--r-- | django/utils/datastructures.py | 20 |
3 files changed, 2 insertions, 27 deletions
diff --git a/django/conf/__init__.py b/django/conf/__init__.py index b993439018..0b20d52484 100644 --- a/django/conf/__init__.py +++ b/django/conf/__init__.py @@ -12,7 +12,6 @@ import time # Needed for Windows from django.conf import global_settings from django.core.exceptions import ImproperlyConfigured -from django.utils.datastructures import dict_merge from django.utils.functional import LazyObject, empty from django.utils import six @@ -78,10 +77,6 @@ class BaseSettings(object): elif name == "ALLOWED_INCLUDE_ROOTS" and isinstance(value, six.string_types): raise ValueError("The ALLOWED_INCLUDE_ROOTS setting must be set " "to a tuple, not a string.") - elif (hasattr(self, name) and name.isupper() and - isinstance(getattr(self, name), dict) and isinstance(value, dict)): - # This allows defining only a partial dict to update a global setting - value = dict_merge(getattr(self, name), value) object.__setattr__(self, name, value) @@ -150,7 +145,7 @@ class UserSettingsHolder(BaseSettings): from the module specified in default_settings (if possible). """ self.__dict__['_deleted'] = set() - self.__dict__['default_settings'] = default_settings + self.default_settings = default_settings def __getattr__(self, name): if name in self._deleted: diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py index 4ba3f27808..9a3dd80d47 100644 --- a/django/db/migrations/loader.py +++ b/django/db/migrations/loader.py @@ -49,7 +49,7 @@ class MigrationLoader(object): @classmethod def migrations_module(cls, app_label): - if settings.MIGRATION_MODULES.get(app_label): + if app_label in settings.MIGRATION_MODULES: return settings.MIGRATION_MODULES[app_label] else: app_package_name = apps.get_app_config(app_label).name diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index ad8792d192..2efcd00eb0 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -244,26 +244,6 @@ class SortedDict(dict): self.keyOrder = [] -def dict_merge(a, b): - """ - Utility to recursively merge two dicts, taking care not to overwrite subkeys - (which would happen with dict.update), but keeping existing key including - those from subdictionaries (optionally opted-out if a `_clear_defaults` key - is present). - Thanks Ross McFarland (https://www.xormedia.com/recursively-merge-dictionaries-in-python/) - """ - if b.get('_clear_defaults'): - return copy.deepcopy(b) - - result = copy.deepcopy(a) - for key, value in six.iteritems(b): - if key in a and isinstance(result[key], dict): - result[key] = dict_merge(result[key], value) - else: - result[key] = value - return result - - class OrderedSet(object): """ A set which keeps the ordering of the inserted items. |
