changeset 99:17001bceec8f

only use formatters for options we actually know about from self.options; the rest should be handled from the client
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 30 Apr 2012 13:02:50 -0700
parents 91e213025769
children aa5c663dd8b7
files configuration/configuration.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/configuration/configuration.py	Mon Apr 30 11:07:17 2012 -0700
+++ b/configuration/configuration.py	Mon Apr 30 13:02:50 2012 -0700
@@ -122,7 +122,8 @@
         formatter = getattr(parser, 'cli_formatter')
         if formatter:
             formatter = formatter(dest)
-            setattr(values, dest, formatter(getattr(values, dest)))
+            if formatter:
+                setattr(values, dest, formatter(getattr(values, dest)))
 
 ### plugins for option types
 ### TODO: this could use a bit of thought
@@ -357,8 +358,9 @@
     ### XXX could go in a subclass
 
     def cli_formatter(self, option):
-        handler = self.types[self.option_dict[option].get('type')]
-        return getattr(handler, 'take_action', lambda x: 1)
+        if option in self.option_dict:
+            handler = self.types[self.option_dict[option].get('type')]
+            return getattr(handler, 'take_action', lambda x: x)
 
     def option_type(self, name):
         """get the type of an option named `name`"""