In AdjustableSettings, initialize all keys on init

Settings.update() method expects keys to already be present, so load
them all up front
This commit is contained in:
Alex Liebowitz 2016-12-01 11:37:06 -05:00
parent 157d6dca93
commit 458561fe6f

View file

@ -185,6 +185,10 @@ class AdjustableSettings(Settings):
"""Settings that are allowed to be overriden by the user"""
def __init__(self, environ=None):
self.environ = environ or ENVIRONMENT
for opt in self.environ.original_schema:
self.__dict__[opt] = self.environ(opt)
Settings.__init__(self)
def __getattr__(self, attr):
@ -192,13 +196,6 @@ class AdjustableSettings(Settings):
return self.environ(attr)
raise AttributeError
def get_dict(self):
return {
name: self.environ(name)
for name in self.environ.original_schema
}
class ApplicationSettings(Settings):
"""Settings that are constants and shouldn't be overriden"""
def __init__(self):