labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1519343 - /labs/panopticon/src/asf/utils/config.py
Date Mon, 02 Sep 2013 05:38:36 GMT
Author: adc
Date: Mon Sep  2 05:38:36 2013
New Revision: 1519343

URL: http://svn.apache.org/r1519343
Log:
Cleaner section bits

Modified:
    labs/panopticon/src/asf/utils/config.py

Modified: labs/panopticon/src/asf/utils/config.py
URL: http://svn.apache.org/viewvc/labs/panopticon/src/asf/utils/config.py?rev=1519343&r1=1519342&r2=1519343&view=diff
==============================================================================
--- labs/panopticon/src/asf/utils/config.py (original)
+++ labs/panopticon/src/asf/utils/config.py Mon Sep  2 05:38:36 2013
@@ -25,14 +25,15 @@ TOOLS_CFG_FILE = os.path.expanduser('~/.
 
 class load_config(object):
     def __init__(self, sections=None, defaults=None):
+        sections = sections or []
         defaults = defaults or {}
+
         self.config = ConfigParser.SafeConfigParser(defaults=defaults)
         self.config.read(TOOLS_CFG_FILE)
 
-        if sections:
-            for section in sections:
-                if not self.config.has_section(section):
-                    self.config.add_section(section)
+        for section in sections:
+            if not self.config.has_section(section):
+                self.config.add_section(section)
 
     def has_option(self, section, option):
         return self.config.has_option(section, option)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message