From 3ca629017c50b7bec36cd3cc93ad94a6c6e83068 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 16 Mar 2012 04:38:31 -0400 Subject: [PATCH] Also adjust HDF5_Storage._load and ._save to work with Group groups. --- h5config/storage/hdf5.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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, -- 2.26.2