From: W. Trevor King Date: Sat, 21 Aug 2010 16:01:19 +0000 (-0400) Subject: Oops, store the serialized Experiment in state not self.info. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=96766f847b6de124dfd1b96eb6e349fdb71a0199;p=hooke.git Oops, store the serialized Experiment in state not self.info. --- 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'])