Mercurial > p > roundup > code
diff roundup/mailgw.py @ 599:08aae4d34622
respect encodings in non multipart messages.
| author | Engelbert Gruber <grubert@users.sourceforge.net> |
|---|---|
| date | Tue, 05 Feb 2002 14:15:29 +0000 |
| parents | 4c3dcda799f7 |
| children | 633f2b542146 |
line wrap: on
line diff
--- a/roundup/mailgw.py Tue Feb 05 09:59:05 2002 +0000 +++ b/roundup/mailgw.py Tue Feb 05 14:15:29 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.61 2002-02-04 09:40:21 grubert Exp $ +$Id: mailgw.py,v 1.62 2002-02-05 14:15:29 grubert Exp $ ''' @@ -505,7 +505,6 @@ data = decoded.getvalue() elif encoding == 'uuencoded': data = binascii.a2b_uu(part.fp.read()) - attachments.append((name, part.gettype(), data)) else: # take it as text data = part.fp.read() @@ -569,8 +568,23 @@ ''' else: - content = message.fp.read() - + encoding = message.getencoding() + if encoding == 'base64': + # BUG: is base64 really used for text encoding or + # are we inserting zip files here. + data = binascii.a2b_base64(message.fp.read()) + elif encoding == 'quoted-printable': + # the quopri module wants to work with files + decoded = cStringIO.StringIO() + quopri.decode(message.fp, decoded) + data = decoded.getvalue() + elif encoding == 'uuencoded': + data = binascii.a2b_uu(message.fp.read()) + else: + # take it as text + data = message.fp.read() + content = data + summary, content = parseContent(content) # @@ -777,6 +791,9 @@ # # $Log: not supported by cvs2svn $ +# Revision 1.61 2002/02/04 09:40:21 grubert +# . add test for multipart messages with first part being encoded. +# # Revision 1.60 2002/02/01 07:43:12 grubert # . mailgw checks encoding on first part too. #
