#NEWLINE# def _handle_multipart( self , msg ) : #NEWLINE# #INDENT# msgtexts = [ ] #NEWLINE# subparts = msg . get_payload ( ) #NEWLINE# if ( subparts is None ) : #NEWLINE# #INDENT# subparts = [ ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( subparts , basestring ) : #NEWLINE# #INDENT# self . _fp . write ( subparts ) #NEWLINE# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not isinstance ( subparts , list ) ) : #NEWLINE# #INDENT# subparts = [ subparts ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for part in subparts : #NEWLINE# #INDENT# s = StringIO ( ) #NEWLINE# g = self . clone ( s ) #NEWLINE# g . flatten ( part , unixfrom = False ) #NEWLINE# msgtexts . append ( s . getvalue ( ) ) #NEWLINE# #UNINDENT# boundary = msg . get_boundary ( ) #NEWLINE# if ( not boundary ) : #NEWLINE# #INDENT# alltext = NL . join ( msgtexts ) #NEWLINE# boundary = _make_boundary ( alltext ) #NEWLINE# msg . set_boundary ( boundary ) #NEWLINE# #UNINDENT# if ( msg . preamble is not None ) : #NEWLINE# #INDENT# ( ( print >> self . _fp ) , msg . preamble ) #NEWLINE# #UNINDENT# ( ( print >> self . _fp ) , ( '--' + boundary ) ) #NEWLINE# if msgtexts : #NEWLINE# #INDENT# self . _fp . write ( msgtexts . pop ( 0 ) ) #NEWLINE# #UNINDENT# for body_part in msgtexts : #NEWLINE# #INDENT# ( ( print >> self . _fp ) , ( '\n--' + boundary ) ) #NEWLINE# self . _fp . write ( body_part ) #NEWLINE# #UNINDENT# self . _fp . write ( ( ( '\n--' + boundary ) + '--' ) ) #NEWLINE# if ( msg . epilogue is not None ) : #NEWLINE# #INDENT# ( print >> self . _fp ) #NEWLINE# self . _fp . write ( msg . epilogue )