# HG changeset patch # User Jeff Hammel # Date 1332806412 25200 # Node ID fadcc6ab51d40cdf424da51d7650e65fc4e0723a # Parent c516ab813079395a4264bd20d535aa3a6335bc7a more (de/)serialization stubbing diff -r c516ab813079 -r fadcc6ab51d4 configuration/config.py --- a/configuration/config.py Mon Mar 26 16:54:37 2012 -0700 +++ b/configuration/config.py Mon Mar 26 17:00:12 2012 -0700 @@ -145,13 +145,18 @@ __all__ += [i.__name__ for i in types.values()] class Configuration(object): - options = {} + """declarative configuration object""" + + options = {} # configuration basis def __init__(self, configuration_providers=configuration_providers, types=types): self.config = {} self.configuration_providers = configuration_providers self.types = types + ### methods for iteration + ### TODO: make this a real iterator + def items(self): # TODO: allow options to be a list of 2-tuples return self.options.items() @@ -262,10 +267,12 @@ def serialize(self, filename, format=None): """serialize configuration to a file""" + # TODO: allow file object vs file name def deserialize(self, filename, format=None): """load configuration from a file""" + # TODO: allow file object vs file name - extension = os.path.splitext(filename)[-1] - if not extension: - return None + if not format: + extension = os.path.splitext(filename)[-1] +