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:
parent
157d6dca93
commit
458561fe6f
1 changed files with 4 additions and 7 deletions
|
@ -185,6 +185,10 @@ class AdjustableSettings(Settings):
|
||||||
"""Settings that are allowed to be overriden by the user"""
|
"""Settings that are allowed to be overriden by the user"""
|
||||||
def __init__(self, environ=None):
|
def __init__(self, environ=None):
|
||||||
self.environ = environ or ENVIRONMENT
|
self.environ = environ or ENVIRONMENT
|
||||||
|
|
||||||
|
for opt in self.environ.original_schema:
|
||||||
|
self.__dict__[opt] = self.environ(opt)
|
||||||
|
|
||||||
Settings.__init__(self)
|
Settings.__init__(self)
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
|
@ -192,13 +196,6 @@ class AdjustableSettings(Settings):
|
||||||
return self.environ(attr)
|
return self.environ(attr)
|
||||||
raise AttributeError
|
raise AttributeError
|
||||||
|
|
||||||
def get_dict(self):
|
|
||||||
return {
|
|
||||||
name: self.environ(name)
|
|
||||||
for name in self.environ.original_schema
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class ApplicationSettings(Settings):
|
class ApplicationSettings(Settings):
|
||||||
"""Settings that are constants and shouldn't be overriden"""
|
"""Settings that are constants and shouldn't be overriden"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
Loading…
Reference in a new issue