|
@@ -140,7 +140,7 @@ class Config(Expando): |
|
|
""" |
|
|
""" |
|
|
|
|
|
|
|
|
def __init__(self, sitepath, config_file=None, config_dict=None): |
|
|
def __init__(self, sitepath, config_file=None, config_dict=None): |
|
|
default_config = dict( |
|
|
|
|
|
|
|
|
self.default_config = dict( |
|
|
mode='production', |
|
|
mode='production', |
|
|
content_root='content', |
|
|
content_root='content', |
|
|
deploy_root='deploy', |
|
|
deploy_root='deploy', |
|
@@ -160,11 +160,7 @@ class Config(Expando): |
|
|
self.load_time = datetime.min |
|
|
self.load_time = datetime.min |
|
|
self.config_files = [] |
|
|
self.config_files = [] |
|
|
self.sitepath = Folder(sitepath) |
|
|
self.sitepath = Folder(sitepath) |
|
|
conf = dict(**default_config) |
|
|
|
|
|
conf.update(self.read_config(config_file)) |
|
|
|
|
|
if config_dict: |
|
|
|
|
|
conf.update(config_dict) |
|
|
|
|
|
super(Config, self).__init__(conf) |
|
|
|
|
|
|
|
|
super(Config, self).__init__(self.load()) |
|
|
|
|
|
|
|
|
@property |
|
|
@property |
|
|
def last_modified(self): |
|
|
def last_modified(self): |
|
@@ -176,6 +172,19 @@ class Config(Expando): |
|
|
return any((conf.has_changed_since(self.load_time) |
|
|
return any((conf.has_changed_since(self.load_time) |
|
|
for conf in self.config_files)) |
|
|
for conf in self.config_files)) |
|
|
|
|
|
|
|
|
|
|
|
def load(self): |
|
|
|
|
|
conf = dict(**self.default_config) |
|
|
|
|
|
conf.update(self.read_config(self.config_file)) |
|
|
|
|
|
if self.config_dict: |
|
|
|
|
|
conf.update(self.config_dict) |
|
|
|
|
|
return conf |
|
|
|
|
|
|
|
|
|
|
|
def reload(self): |
|
|
|
|
|
if not self.config_file: |
|
|
|
|
|
return |
|
|
|
|
|
self.update(self.load()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def read_config(self, config_file): |
|
|
def read_config(self, config_file): |
|
|
""" |
|
|
""" |
|
|
Reads the configuration file and updates this |
|
|
Reads the configuration file and updates this |
|
|