def kill_with_contents(self):
        """
        Kill this Node including the 'logical contents' of the node. i.e. 
        the contents of the node that are self.members as well as non-members. 
        Example: A DnaSegment's logical contents are AxisChunks and StrandChunks 
        Out of these, only AxisChunks are the direct members of the DnaSegment
        but the 'StrandChunks are logical contents of it (non-members) . 
        So, some callers may specifically want to delete self along with its 
        members and logical contents. These callers should use this method. 
        The default implementation just calls self.kill()
        @see: B{Node.DnaSegment.kill_with_contents}  which is overridden here
              method. 
        @see: EditCommand._removeStructure() which calls this Node API method
        @see: DnaDuplex_EditCommand._removeSegments()
        @see: dna_model.DnaLadder.kill_strand_chunks() for a comment.
        
        @see: A note in self.kill() about NFR bug 2749
        
        """
        for member in self.members:
            if isinstance(member, DnaAxisChunk):
                ladder = member.ladder
                try:
                    #See a note in dna_model.kill_strand_chunks. Should we
                    #instead call ladder.kill() and thus kill bothstrand
                    #and axis chunks. ?
                    ladder.kill_strand_chunks()
                except:
                    print_compact_traceback("bug in killing the ladder chunk")

        DnaStrandOrSegment.kill_with_contents(self)
Example #2
0
 def kill_with_contents(self):  
     """
     Kill this Node including the 'logical contents' of the node. i.e. 
     the contents of the node that are self.members as well as non-members. 
     Example: A DnaSegment's logical contents are AxisChunks and StrandChunks 
     Out of these, only AxisChunks are the direct members of the DnaSegment
     but the 'StrandChunks are logical contents of it (non-members) . 
     So, some callers may specifically want to delete self along with its 
     members and logical contents. These callers should use this method. 
     The default implementation just calls self.kill()
     @see: B{Node.DnaSegment.kill_with_contents}  which is overridden here
           method. 
     @see: EditCommand._removeStructure() which calls this Node API method
     @see: InsertDna_EditCommand._removeSegments()
     @see: dna_model.DnaLadder.kill_strand_chunks() for a comment.
     
     @see: A note in self.kill() about NFR bug 2749
     
     """   
     for member in self.members:            
         if isinstance(member, DnaAxisChunk):                
             ladder = member.ladder
             try:
                 #See a note in dna_model.kill_strand_chunks. Should we 
                 #instead call ladder.kill() and thus kill bothstrand 
                 #and axis chunks. ?
                 ladder.kill_strand_chunks()
             except:
                 print_compact_traceback("bug in killing the ladder chunk")
     
     DnaStrandOrSegment.kill_with_contents(self)
    def kill(self):
        """
        Overrides superclass method. For a Dnasegment , as of 2008-04-09,
        the default implementation is that deleting a segment will delete 
        the segment along with its logical contents (see bug 2749).
        It is tempting to call self.kill_with_contents , BUT DON'T CALL IT HERE!
        ...as kill_with_contents  is used elsewhere (before bug 2749 NFR was
        suggested and it calls self.kill() at the end. So that will create 
        infinite recursions. 
        @TODO: code cleanup/ refactoring to resolve kill_with_content issue
        """

        #The following block is copied over from self.kill_with_contents()
        #It implements behavior suggested in bug 2749 (deleting a segment will
        #delete the segment along with its logical contents )
        #See method docsting above on why we shouldn't call that method instead
        for member in self.members:
            if isinstance(member, DnaAxisChunk):
                ladder = member.ladder
                try:
                    #See a note in dna_model.kill_strand_chunks. Should we
                    #instead call ladder.kill() and thus kill bothstrand
                    #and axis chunks. ?
                    ladder.kill_strand_chunks()
                except:
                    print_compact_traceback("bug in killing the ladder chunk")

        DnaStrandOrSegment.kill(self)
Example #4
0
 def kill(self):
     """
     Overrides superclass method. For a Dnasegment , as of 2008-04-09,
     the default implementation is that deleting a segment will delete 
     the segment along with its logical contents (see bug 2749).
     """
     # It is tempting to call self.kill_with_contents , BUT DON'T CALL IT HERE!
     # ...as kill_with_contents  is used elsewhere (before bug 2749 NFR was
     # suggested and it calls self.kill() at the end. So that will create 
     # infinite recursions. 
     ### TODO: code cleanup/ refactoring to resolve kill_with_content issue
     
     #The following block is copied over from self.kill_with_contents()
     #It implements behavior suggested in bug 2749 (deleting a segment will 
     #delete the segment along with its logical contents )
     #See method docsting above on why we shouldn't call that method instead
     for member in self.members:
         if isinstance(member, DnaAxisChunk):          
             ladder = member.ladder
             try:
                 #See a note in dna_model.kill_strand_chunks. Should we 
                 #instead call ladder.kill() and thus kill bothstrand 
                 #and axis chunks. ?
                 ladder.kill_strand_chunks()
             except:
                 print_compact_traceback("bug in killing the ladder chunk")
                 
     DnaStrandOrSegment.kill(self)