# HG changeset patch # User Jeff Hammel # Date 1335560241 25200 # Node ID 6067ae61cd173bf8018de83804cdedbee100505a # Parent a2d8e7bbb95fc16919fb11f5c1cf5df5451cc747 use self.option_dict diff -r a2d8e7bbb95f -r 6067ae61cd17 configuration/configuration.py --- a/configuration/configuration.py Fri Apr 27 13:44:12 2012 -0700 +++ b/configuration/configuration.py Fri Apr 27 13:57:21 2012 -0700 @@ -291,15 +291,15 @@ """ # ensure options in configuration are in self.options - unknown_options = [i for i in config if i not in self.options] + unknown_options = [i for i in config if i not in self.option_dict] if unknown_options: raise UnknownOptionException("Unknown options: %s" % ', '.join(unknown_options)) # ensure options are of the right type (if specified) for key, value in config.items(): - _type = self.options[key].get('type') - if _type is None and 'default' in self.options[key]: - _type = type(self.options[key]['default']) + _type = self.option_dict[key].get('type') + if _type is None and 'default' in self.option_dict[key]: + _type = type(self.option_dict[key]['default']) if _type is not None and not isinstance(value, _type): try: config[key] = _type(value) @@ -352,7 +352,7 @@ ### XXX could go in a subclass def cli_formatter(self, option): - handler = self.types[self.options[option].get('type')] + handler = self.types[self.option_dict[option].get('type')] return getattr(handler, 'take_action', lambda x: 1) def optparse_options(self, parser): @@ -372,7 +372,7 @@ # get CLI configuration options cli_config = dict([(key, value) for key, value in options.__dict__.items() - if key in self.options and key in self.parsed]) + if key in self.option_dict and key in self.parsed]) # deserialize configuration configuration_files = getattr(options, 'load', args)