(self, objOrName, group=None)
return obj
Add objOrName to contents, set behavior if it can be inferred.

        If objOrName is a string, create an empty component or line based on
        behavior. If no behavior is found for the object, add a ContentLine.

        group is an optional prefix to the name of the object (see RFC 2425).
Add objOrName to contents, set behavior if it can be inferred.
Add objOrName to contents set behavior if it can be inferred .
def add(self, objOrName, group=None):
        """
        Add objOrName to contents, set behavior if it can be inferred.

        If objOrName is a string, create an empty component or line based on
        behavior. If no behavior is found for the object, add a ContentLine.

        group is an optional prefix to the name of the object (see RFC 2425).
        """
        if isinstance(objOrName, VBase):
            obj = objOrName
            if self.behavior:
                obj.parentBehavior = self.behavior
                obj.autoBehavior(True)
        else:
            name = objOrName.upper()
            try:
                id = self.behavior.knownChildren[name][2]
                behavior = getBehavior(name, id)
                if behavior.isComponent:
                    obj = Component(name)
                else:
                    obj = ContentLine(name, [], '', group)
                obj.parentBehavior = self.behavior
                obj.behavior = behavior
                obj = obj.transformToNative()
            except (KeyError, AttributeError):
                obj = ContentLine(objOrName, [], '', group)
            if obj.behavior is None and self.behavior is not None:
                if isinstance(obj, ContentLine):
                    obj.behavior = self.behavior.defaultBehavior
        self.contents.setdefault(obj.name.lower(), []).append(obj)
        return obj
def add ( self , objOrName , group = None ) : if isinstance ( objOrName , VBase ) : obj = objOrName if self . behavior : obj . parentBehavior = self . behavior obj . autoBehavior ( True ) else : name = objOrName . upper ( ) try : id = self . behavior . knownChildren [ name ] [ 2 ] behavior = getBehavior ( name , id ) if behavior . isComponent : obj = Component ( name ) else : obj = ContentLine ( name , [ ] , '' , group ) obj . parentBehavior = self . behavior obj . behavior = behavior obj = obj . transformToNative ( ) except ( KeyError , AttributeError ) : obj = ContentLine ( objOrName , [ ] , '' , group ) if obj . behavior is None and self . behavior is not None : if isinstance ( obj , ContentLine ) : obj . behavior = self . behavior . defaultBehavior self . contents . setdefault ( obj . name . lower ( ) , [ ] ) . append ( obj ) return obj