(self, channel)
return False
Inserts the channel recursivly in the channel tree.
        Returns true, if the tree has been inserted.
Inserts the channel recursivly in the channel tree.
        Returns true, if the tree has been inserted.
Inserts the channel recursivly in the channel tree . Returns true if the tree has been inserted .
def _insert(self, channel):
        """
        Inserts the channel recursivly in the channel tree.
        Returns true, if the tree has been inserted.
        """
        # We assumed on previous insertions, that a channel is a direct child
        # of the root, if we could not find the parent. Correct this, if ctree
        # is the parent from one of these orpheans.
        if self.is_root():
            i = 0
            while i < len(self.childs):
                child = self.childs[i]
                if channel.info["cid"] == child.info["pid"]:
                    channel.childs.append(child)
                    self.childs.pop(i)
                else:
                    i += 1

        # This is not the root and the channel is a direct child of this one.
        elif channel.info["pid"] == self.info["cid"]:
            self.childs.append(channel)
            return True

        # Try to insert the channel recursive.
        for child in self.childs:
            if child._insert(channel):
                return True

        # If we could not find a parent in the whole tree, assume, that the
        # channel is a child of the root.
        if self.is_root():
            self.childs.append(channel)
        return False
def _insert ( self , channel ) : # We assumed on previous insertions, that a channel is a direct child # of the root, if we could not find the parent. Correct this, if ctree # is the parent from one of these orpheans. if self . is_root ( ) : i = 0 while i < len ( self . childs ) : child = self . childs [ i ] if channel . info [ "cid" ] == child . info [ "pid" ] : channel . childs . append ( child ) self . childs . pop ( i ) else : i += 1 # This is not the root and the channel is a direct child of this one. elif channel . info [ "pid" ] == self . info [ "cid" ] : self . childs . append ( channel ) return True # Try to insert the channel recursive. for child in self . childs : if child . _insert ( channel ) : return True # If we could not find a parent in the whole tree, assume, that the # channel is a child of the root. if self . is_root ( ) : self . childs . append ( channel ) return False