changeset 54:135322cc5bc0

document this
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 27 Mar 2012 14:41:13 -0700
parents 18f8107aa4f9
children 87bd539a21d3
files configuration/config.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/configuration/config.py	Tue Mar 27 14:23:39 2012 -0700
+++ b/configuration/config.py	Tue Mar 27 14:41:13 2012 -0700
@@ -325,7 +325,9 @@
         """
         parse configuration including command line options
         - args: command line arguments to parse (default: system arguments)
-        - parser
+        - parser: a parser instance
+        - config_provider_option: option for configuration files; if None,
+          will be taken from remaining args
         """
 
         # parse arguments
@@ -343,7 +345,7 @@
                                if key in parser.parsed])
 
         # deserialize configuration
-        configuration_files = getattr(options, 'load', [])
+        configuration_files = getattr(options, 'load', args)
         missing = [i for i in configuration_files
                    if not os.path.exists(i)]
         if missing:
@@ -360,7 +362,7 @@
         try:
             # generate configuration
             self(*config)
-        except MissingValueException, e:
+        except MissingValueException, missingvalues:
             pass
 
         # dump configuration, if specified
@@ -371,7 +373,7 @@
 
         if missingvalues and not dump:
             # XXX assuming if you don't have values you were just dumping
-            parser.error(str(e))
+            raise missingvalues
 
         # return parsed arguments
         return options, args