From 96766f847b6de124dfd1b96eb6e349fdb71a0199 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 21 Aug 2010 12:01:19 -0400 Subject: [PATCH] Oops, store the serialized Experiment in state not self.info. --- hooke/curve.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/hooke/curve.py b/hooke/curve.py index af572f3..75fbf75 100644 --- a/hooke/curve.py +++ b/hooke/curve.py @@ -191,17 +191,18 @@ class Curve (object): self.name = os.path.basename(path) def __getstate__(self): - state = dict(self.__dict__) + state = dict(self.__dict__) # make a copy of the attribute dict. + state['info'] = dict(self.info) # make a copy of the info dict too. del(state['_hooke']) dc = state['command_stack'] if hasattr(dc, '__getstate__'): state['command_stack'] = dc.__getstate__() - if self.info.get('experiment', None) != None: - e = self.info['experiment'] - assert isinstance(e, experiment.Experiment) + if state['info'].get('experiment', None) != None: + e = state['info']['experiment'] + assert isinstance(e, experiment.Experiment), type(e) # HACK? require Experiment classes to be defined in the # experiment module. - self.info['experiment'] = e.__class__.__name__ + state['info']['experiment'] = e.__class__.__name__ return state def __setstate__(self, state): @@ -213,7 +214,7 @@ class Curve (object): elif key == 'info': if 'experiment' not in value: value['experiment'] = None - else: + elif value['experiment'] != None: # HACK? require Experiment classes to be defined in the # experiment module. cls = getattr(experiment, value['experiment']) -- 2.26.2