summaryrefslogtreecommitdiff
path: root/django/conf/__init__.py
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2014-01-20 10:45:21 +0800
committerRussell Keith-Magee <russell@keith-magee.com>2014-01-20 10:45:21 +0800
commitd818e0c9b2b88276cc499974f9eee893170bf0a8 (patch)
tree13ef631f7ba50bf81fa36f484abf925ba8172651 /django/conf/__init__.py
parent6e7bd0b63bd01949ac4fd647f2597639bed0c3a2 (diff)
downloaddjango-d818e0c9b2b88276cc499974f9eee893170bf0a8.tar.gz
Fixed #16905 -- Added extensible checks (nee validation) framework
This is the result of Christopher Medrela's 2013 Summer of Code project. Thanks also to Preston Holmes, Tim Graham, Anssi Kääriäinen, Florian Apolloner, and Alex Gaynor for review notes along the way. Also: Fixes #8579, fixes #3055, fixes #19844.
Diffstat (limited to 'django/conf/__init__.py')
-rw-r--r--django/conf/__init__.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/django/conf/__init__.py b/django/conf/__init__.py
index e10d4b1afb..aad67bd7f5 100644
--- a/django/conf/__init__.py
+++ b/django/conf/__init__.py
@@ -99,7 +99,7 @@ class Settings(BaseSettings):
)
tuple_settings = ("INSTALLED_APPS", "TEMPLATE_DIRS")
-
+ self._explicit_settings = set()
for setting in dir(mod):
if setting.isupper():
setting_value = getattr(mod, setting)
@@ -110,6 +110,7 @@ class Settings(BaseSettings):
"Please fix your settings." % setting)
setattr(self, setting, setting_value)
+ self._explicit_settings.add(setting)
if not self.SECRET_KEY:
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
@@ -126,6 +127,9 @@ class Settings(BaseSettings):
os.environ['TZ'] = self.TIME_ZONE
time.tzset()
+ def is_overridden(self, setting):
+ return setting in self._explicit_settings
+
class UserSettingsHolder(BaseSettings):
"""
@@ -159,4 +163,10 @@ class UserSettingsHolder(BaseSettings):
def __dir__(self):
return list(self.__dict__) + dir(self.default_settings)
+ def is_overridden(self, setting):
+ if setting in self._deleted:
+ return False
+ else:
+ return self.default_settings.is_overridden(setting)
+
settings = LazySettings()