commit 01c410b21020932179b3d62a73268f1132067ba5 Author: Darius Bacon darius@wry.me Date: Tue Apr 15 16:24:56 2014 -0700
simpler Config.load() --- oonib/config.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/oonib/config.py b/oonib/config.py index 6fea660..afe3091 100644 --- a/oonib/config.py +++ b/oonib/config.py @@ -23,19 +23,17 @@ class Config(object): raise e.ConfigFileNotSpecified
try: - with open(self.opts['config']) as f: + with open(config_file) as f: configuration = yaml.safe_load(f) except IOError: - raise e.ConfigFileDoesNotExist(self.opts['config']) + raise e.ConfigFileDoesNotExist(config_file) + + self.main = Storage(configuration['main'].items())
- self.main = Storage() - for k, v in configuration['main'].items(): - self.main[k] = v self.helpers = Storage() for name, helper in configuration['helpers'].items(): - self.helpers[name] = Storage() - for k, v in helper.items(): - self.helpers[name][k] = v + self.helpers[name] = Storage(helper.items()) + self.check_paths()
def check_paths(self):
tor-commits@lists.torproject.org