From: W. Trevor King Date: Fri, 16 Mar 2012 08:38:31 +0000 (-0400) Subject: Also adjust HDF5_Storage._load and ._save to work with Group groups. X-Git-Tag: v0.2~9 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3ca629017c50b7bec36cd3cc93ad94a6c6e83068;p=h5config.git Also adjust HDF5_Storage._load and ._save to work with Group groups. --- diff --git a/h5config/storage/hdf5.py b/h5config/storage/hdf5.py index 2f1d660..34f4fae 100644 --- a/h5config/storage/hdf5.py +++ b/h5config/storage/hdf5.py @@ -158,9 +158,12 @@ class HDF5_Storage (_FileStorage): f = None try: if group is None: - self._check_file() - f = _h5py.File(self._filename, 'r') - group = f[self.group] + if isinstance(self.group, _h5py.Group): + group = self.group + else: + self._check_file() + f = _h5py.File(self._filename, 'r') + group = f[self.group] for s in config.settings: if s.name not in group.keys(): continue @@ -228,9 +231,12 @@ class HDF5_Storage (_FileStorage): f = None try: if group is None: - self._check_file() - f = _h5py.File(self._filename, 'a') - group = f[self.group] + if isinstance(self.group, _h5py.Group): + group = self.group + else: + self._check_file() + f = _h5py.File(self._filename, 'a') + group = f[self.group] for s in config.settings: value = None if isinstance(s, (_config.BooleanSetting,