fix the exception about _update_label_buf when copying and pickling

This commit is contained in:
Zhenwen Dai 2014-10-14 10:12:46 +01:00
parent 1a59d527a3
commit 55077161d4

View file

@ -172,6 +172,7 @@ class Parameterized(Parameterizable):
if not isinstance(param,Tie): if not isinstance(param,Tie):
self._highest_parent_.ties.mergeTies(param) self._highest_parent_.ties.mergeTies(param)
else: else:
if hasattr(self._highest_parent_,'ties'):
self._highest_parent_.ties._update_label_buf() self._highest_parent_.ties._update_label_buf()
else: else:
raise HierarchyError, """Parameter exists already, try making a copy""" raise HierarchyError, """Parameter exists already, try making a copy"""
@ -220,6 +221,7 @@ class Parameterized(Parameterizable):
if not isinstance(param,Tie): if not isinstance(param,Tie):
self._highest_parent_.ties.splitTies(param) self._highest_parent_.ties.splitTies(param)
else: else:
if hasattr(self._highest_parent_,'ties'):
self._highest_parent_.ties._update_label_buf() self._highest_parent_.ties._update_label_buf()
def add_parameter(self, *args, **kwargs): def add_parameter(self, *args, **kwargs):