comparison roundup/mailgw.py @ 1320:3758a5af985f

Lots of little fixes in this update: - fixed Date.local() - email quoted text stripping is controllable again [SF#650742] - extract attachment name from content-disposition if name missing [SF#637278] - removed FILTER_POSITION from bundled configs - reverse message listing in issue display (reversion of recent change) - bad entries for multilink editing in cgi don't traceback now [SF#640310]
author Richard Jones <richard@users.sourceforge.net>
date Tue, 10 Dec 2002 00:11:16 +0000
parents b2d04ce03802
children 328d68db2ef8
comparison
equal deleted inserted replaced
1319:f8cc0b724b28 1320:3758a5af985f
71 set() method to add the message to the item's spool; in the second case we 71 set() method to add the message to the item's spool; in the second case we
72 are calling the create() method to create a new node). If an auditor raises 72 are calling the create() method to create a new node). If an auditor raises
73 an exception, the original message is bounced back to the sender with the 73 an exception, the original message is bounced back to the sender with the
74 explanatory message given in the exception. 74 explanatory message given in the exception.
75 75
76 $Id: mailgw.py,v 1.99 2002-11-05 22:59:46 richard Exp $ 76 $Id: mailgw.py,v 1.100 2002-12-10 00:11:15 richard Exp $
77 ''' 77 '''
78 78
79 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri 79 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
80 import time, random, sys 80 import time, random, sys
81 import traceback, MimeWriter 81 import traceback, MimeWriter
721 name = mailmess.getheader('subject') 721 name = mailmess.getheader('subject')
722 part.fp.seek(i) 722 part.fp.seek(i)
723 attachments.append((name, 'message/rfc822', part.fp.read())) 723 attachments.append((name, 'message/rfc822', part.fp.read()))
724 else: 724 else:
725 # try name on Content-Type 725 # try name on Content-Type
726 name = part.getparam('name') 726 name = part.getparam('name').strip()
727 if not name:
728 disp = part.getheader('content-disposition', None)
729 if disp:
730 name = disp.getparam('filename').strip()
727 # this is just an attachment 731 # this is just an attachment
728 data = self.get_part_data_decoded(part) 732 data = self.get_part_data_decoded(part)
729 attachments.append((name, part.gettype(), data)) 733 attachments.append((name, part.gettype(), data))
730 if content is None: 734 if content is None:
731 raise MailUsageError, ''' 735 raise MailUsageError, '''
759 763
760 else: 764 else:
761 content = self.get_part_data_decoded(message) 765 content = self.get_part_data_decoded(message)
762 766
763 # figure how much we should muck around with the email body 767 # figure how much we should muck around with the email body
764 keep_citations = getattr(self.instance, 'EMAIL_KEEP_QUOTED_TEXT', 768 keep_citations = getattr(self.instance.config, 'EMAIL_KEEP_QUOTED_TEXT',
765 'no') == 'yes' 769 'no') == 'yes'
766 keep_body = getattr(self.instance, 'EMAIL_LEAVE_BODY_UNCHANGED', 770 keep_body = getattr(self.instance.config, 'EMAIL_LEAVE_BODY_UNCHANGED',
767 'no') == 'yes' 771 'no') == 'yes'
768 772
769 # parse the body of the message, stripping out bits as appropriate 773 # parse the body of the message, stripping out bits as appropriate
770 summary, content = parseContent(content, keep_citations, 774 summary, content = parseContent(content, keep_citations,
771 keep_body) 775 keep_body)

Roundup Issue Tracker: http://roundup-tracker.org/