From: W. Trevor King Date: Thu, 8 Sep 2011 21:37:59 +0000 (-0400) Subject: Add public Config.set_storage() method. X-Git-Tag: v0.2~25 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b26378d5a5f4a0937cf6f4043c4af3071a664a7a;p=h5config.git Add public Config.set_storage() method. --- diff --git a/h5config/config.py b/h5config/config.py index 8d83174..2814fa4 100644 --- a/h5config/config.py +++ b/h5config/config.py @@ -251,11 +251,14 @@ class Config (dict): def __init__(self, storage=None): super(Config, self).__init__() self.clear() - self._storage = storage + self.set_storage(storage=storage) def __repr__(self): return '<{} {}>'.format(self.__class__.__name__, id(self)) + def set_storage(self, storage): + self._storage = storage + def clear(self): super(Config, self).clear() for s in self.settings: diff --git a/h5config/storage/__init__.py b/h5config/storage/__init__.py index b9d72e5..428e98e 100644 --- a/h5config/storage/__init__.py +++ b/h5config/storage/__init__.py @@ -22,7 +22,7 @@ class Storage (object): if merge: self.clear() self._load(config=config, **kwargs) - config._storage = self + config.set_storage(storage=self) def _load(self, config, **kwargs): raise NotImplementedError()