[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [oonib/master] simpler Config.load()



commit abfaed208212af9c65de0fed6ab1ea5b344e4823
Author: Darius Bacon <darius@xxxxxx>
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 mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits