@@ -73,7 +73,7 @@ class node. Any parts of other types are each stored in separate files
7373an exception, the original message is bounced back to the sender with the
7474explanatory message given in the exception.
7575
76- $Id: mailgw.py,v 1.126.2.2 2004-01-07 22:44:44 richard Exp $
76+ $Id: mailgw.py,v 1.126.2.3 2004-03-24 22:27:39 richard Exp $
7777"""
7878
7979import string , re , os , mimetools , cStringIO , smtplib , socket , binascii , quopri
@@ -765,10 +765,10 @@ def handle_message(self, message):
765765 # flagging.
766766 # multipart/form-data:
767767 # For web forms only.
768+ content = None
768769 if content_type == 'multipart/mixed' :
769770 # skip over the intro to the first boundary
770771 part = message .getPart ()
771- content = None
772772 while 1 :
773773 # get the next part
774774 part = message .getPart ()
@@ -814,42 +814,19 @@ def handle_message(self, message):
814814 # this is just an attachment
815815 data = self .get_part_data_decoded (part )
816816 attachments .append ((name , part .gettype (), data ))
817- if content is None :
818- raise MailUsageError , '''
819- Roundup requires the submission to be plain text. The message parser could
820- not find a text/plain part to use.
821- '''
822817
823- elif content_type [:10 ] == 'multipart/' :
824- # skip over the intro to the first boundary
825- message .getPart ()
826- content = None
827- while 1 :
828- # get the next part
829- part = message .getPart ()
830- if part is None :
831- break
832- # parse it
833- if part .gettype () == 'text/plain' and not content :
834- content = self .get_part_data_decoded (part )
835- if content is None :
836- raise MailUsageError , '''
837- Roundup requires the submission to be plain text. The message parser could
838- not find a text/plain part to use.
839- '''
818+ elif content_type == 'text/plain' :
819+ content = self .get_part_data_decoded (message )
840820
841- elif content_type != 'text/plain' :
821+ if content is None :
842822 raise MailUsageError , '''
843823Roundup requires the submission to be plain text. The message parser could
844824not find a text/plain part to use.
845825'''
846-
847- else :
848- content = self .get_part_data_decoded (message )
849826
850827 # figure how much we should muck around with the email body
851- keep_citations = getattr (self .instance .config , 'EMAIL_KEEP_QUOTED_TEXT' ,
852- 'no' ) == 'yes'
828+ keep_citations = getattr (self .instance .config ,
829+ 'EMAIL_KEEP_QUOTED_TEXT' , ' no' ) == 'yes'
853830 keep_body = getattr (self .instance .config , 'EMAIL_LEAVE_BODY_UNCHANGED' ,
854831 'no' ) == 'yes'
855832
0 commit comments