def add(self, name, obj): if isinstance(obj, VariableTree): if self.trait(name) is None: self.add_trait(name, Slot(VariableTree, iotype=obj._iotype)) self.on_trait_change(self._trait_modified, name) elif not IVariable.providedBy(obj): msg = "a VariableTree may only contain Variables or other " + \ "VariableTrees" self.raise_exception(msg, TypeError) return super(VariableTree, self).add(name, obj)
def add(self, name, obj): if not (IVariable.providedBy(obj) or isinstance(obj, VarTree)): msg = "a VariableTree may only contain Variables or VarTrees" self.raise_exception(msg, TypeError) return super(VariableTree, self).add(name, obj)