diff 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
line wrap: on
line diff
--- a/roundup/mailgw.py	Mon Dec 09 02:51:46 2002 +0000
+++ b/roundup/mailgw.py	Tue Dec 10 00:11:16 2002 +0000
@@ -73,7 +73,7 @@
 an exception, the original message is bounced back to the sender with the
 explanatory message given in the exception. 
 
-$Id: mailgw.py,v 1.99 2002-11-05 22:59:46 richard Exp $
+$Id: mailgw.py,v 1.100 2002-12-10 00:11:15 richard Exp $
 '''
 
 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
@@ -723,7 +723,11 @@
                     attachments.append((name, 'message/rfc822', part.fp.read()))
                 else:
                     # try name on Content-Type
-                    name = part.getparam('name')
+                    name = part.getparam('name').strip()
+                    if not name:
+                        disp = part.getheader('content-disposition', None)
+                        if disp:
+                            name = disp.getparam('filename').strip()
                     # this is just an attachment
                     data = self.get_part_data_decoded(part) 
                     attachments.append((name, part.gettype(), data))
@@ -761,9 +765,9 @@
             content = self.get_part_data_decoded(message) 
  
         # figure how much we should muck around with the email body
-        keep_citations = getattr(self.instance, 'EMAIL_KEEP_QUOTED_TEXT',
+        keep_citations = getattr(self.instance.config, 'EMAIL_KEEP_QUOTED_TEXT',
             'no') == 'yes'
-        keep_body = getattr(self.instance, 'EMAIL_LEAVE_BODY_UNCHANGED',
+        keep_body = getattr(self.instance.config, 'EMAIL_LEAVE_BODY_UNCHANGED',
             'no') == 'yes'
 
         # parse the body of the message, stripping out bits as appropriate

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