changeset 117:dd3480af4cd5

separate into own method
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 04 Dec 2012 15:01:28 -0800
parents 9d19ed8fd883
children 1d6ac93d1d79
files configuration/configuration.py
diffstat 1 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/configuration/configuration.py	Mon Oct 01 17:08:45 2012 -0700
+++ b/configuration/configuration.py	Tue Dec 04 15:01:28 2012 -0800
@@ -432,16 +432,9 @@
                 continue
             parser.add_option(*args, **kw)
 
-    def parse_args(self, *args, **kw):
-
-        self.parsed = dict()
-        options, args = optparse.OptionParser.parse_args(self, *args, **kw)
+    def read_configuration_files(self, options, args):
+        """deserialize configuration"""
 
-        # get CLI configuration options
-        cli_config = dict([(key, value) for key, value in options.__dict__.items()
-                           if key in self.option_dict and key in self.parsed])
-
-        # deserialize configuration
         configuration_files = getattr(options, self.load_option, args)
         if not configuration_files:
             configuration_files = []
@@ -459,6 +452,19 @@
                     config.append(loaded_config)
             except BaseException, e:
                 parser.error(str(e))
+        return config
+
+    def parse_args(self, *args, **kw):
+
+        self.parsed = dict()
+        options, args = optparse.OptionParser.parse_args(self, *args, **kw)
+
+        # get CLI configuration options
+        cli_config = dict([(key, value) for key, value in options.__dict__.items()
+                           if key in self.option_dict and key in self.parsed])
+
+        # deserialize configuration
+        config = self.read_configuration_files(options, args)
         config.append(cli_config)
 
         missingvalues = None