# HG changeset patch # User Jeff Hammel # Date 1335816170 25200 # Node ID 17001bceec8f0df94a9001e7bccd67d290f54f6b # Parent 91e213025769f23e8bc5dc7386b4e2276a846de7 only use formatters for options we actually know about from self.options; the rest should be handled from the client diff -r 91e213025769 -r 17001bceec8f configuration/configuration.py --- 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`"""