#NEWLINE# def setChildrenAllowed( self , itemId , childrenAllowed ) : #NEWLINE# #INDENT# "Sets the given Item's capability to have children. If the Item\n        identified with the itemId already has children and the\n        areChildrenAllowed is false this method fails and C{False}\n        is returned; the children must be first explicitly removed with\n        L{setParent} or L{IContainer.removeItem}.\n\n        @param itemId:\n                   the ID of the Item in the container whose child capability\n                   is to be set.\n        @param childrenAllowed:\n                   the boolean value specifying if the Item can have children\n                   or not.\n        @return: C{True} if the operation succeeded, C{False} if not\n        " #NEWLINE# if ( not self . containsId ( itemId ) ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if childrenAllowed : #NEWLINE# #INDENT# if ( itemId in self . _noChildrenAllowed ) : #NEWLINE# #INDENT# self . _noChildrenAllowed . remove ( childrenAllowed ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . _noChildrenAllowed . add ( itemId ) #NEWLINE# #UNINDENT# return True