def __setattr__(self, name, value): if self.__locked_down and not hasattr(self, name): # @fixme HACK if condition is related to too much magic. Fixme # when the nodes are refecatored: if name not in ('__factory__', '__node_id__'): raise AttributeError("NodeDecorator's do not support dynamic" " creation of attributes.") CompositeNode.__setattr__(self, name, value) return
def __init__(self): CompositeNode.__setattr__(self, '_NodeDecorator__locked_down', False) CompositeNode.__init__(self) # HACK: Create default attributes before "locking down" this node's # attributes. CompositeNode.configure(self, {}) self.__locked_down = True assert self._PREFIX is not None, ( "Concrete class must set _PREFIX class variable.") assert self._PREFIX[-1] == '_', ( "_PREFIX class variable must end in an underbar (_).") return
def __init__(self): CompositeNode.__setattr__(self, '_NodeDecorator__locked_down', False) CompositeNode.__init__(self) # HACK: Create default attributes before "locking down" this node's # attributes. CompositeNode.configure(self, {}) self.__locked_down = True assert self._PREFIX is not None, ( "Concrete class must set _PREFIX class variable." ) assert self._PREFIX[-1] == '_', ( "_PREFIX class variable must end in an underbar (_)." ) return
def factory(): return CompositeNode()