def niceStringify( self, level ): " Returns a string representation with new lines and shifts " joiner = "\n" + ( level + 1 ) * " " return level * " " + "CML record: " + Fragment.__str__( self ) + \ joiner + joiner.join( [ str( item ) for item in self.parts ] )
def __str__( self ): " Converts to string " return "CML record: " + Fragment.__str__( self ) + \ "\nBody:\n" + "\n".join( [ str( item ) for item in self.parts ] )
def __init__( self ): Fragment.__init__( self ) self.parts = [] # Fragments for individual parts (lines) return