summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dd1d3f2)
raw | patch | inline | side by side (parent: dd1d3f2)
author | grubert <grubert@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 5 Feb 2002 14:15:29 +0000 (14:15 +0000) | ||
committer | grubert <grubert@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 5 Feb 2002 14:15:29 +0000 (14:15 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@612 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/mailgw.py | patch | blob | history | |
test/test_mailgw.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index 8307c0fefba045b19e8ce07814494fe49ca2b452..84f02a598d75645a6e1ac7009fa73196b7a69b7f 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
. you can now use the roundup-admin tool pack the database
Fixed:
+ . respect encodings in non multipart messages.
. makeHtmlBase: re.sub under python 2.2 did not replace '.', string.replace does it.
. preamble in tepmlateBuilder mentioned htmldata
. mailgw checks encoding on first part too.
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index bf02c3bd1c29fbd6b692b58b7ffd612d41e9f144..b624b1bc6f560e3cc6db156344d38166c9bd7855 100644 (file)
--- a/roundup/mailgw.py
+++ b/roundup/mailgw.py
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 $
'''
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()
'''
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)
#
#
# $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.
#
diff --git a/test/test_mailgw.py b/test/test_mailgw.py
index cb53984dc4cdd0e275daada0b0972e3edf4640fe..382c8f27805ad2e7161389bb5daf3ac080458998 100644 (file)
--- a/test/test_mailgw.py
+++ b/test/test_mailgw.py
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: test_mailgw.py,v 1.8 2002-02-04 09:40:21 grubert Exp $
+# $Id: test_mailgw.py,v 1.9 2002-02-05 14:15:29 grubert Exp $
import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys
___________________________________________________
''', 'Generated message not correct')
+ def testEnc01(self):
+ self.testNewIssue()
+ message = cStringIO.StringIO('''Content-Type: text/plain;
+ charset="iso-8859-1"
+From: mary <mary@test>
+To: issue_tracker@fill.me.in.
+Message-Id: <followup_dummy_id>
+In-Reply-To: <dummy_test_message_id>
+Subject: [issue1] Testing...
+Content-Type: text/plain;
+ charset="iso-8859-1"
+Content-Transfer-Encoding: quoted-printable
+
+A message with encoding (encoded oe =F6)
+
+''')
+ handler = self.instance.MailGW(self.instance, self.db)
+ handler.main(message)
+ message_data = open(os.environ['SENDMAILDEBUG']).read()
+ self.assertEqual(message_data,
+'''FROM: roundup-admin@fill.me.in.
+TO: chef@bork.bork.bork, richard@test
+Content-Type: text/plain
+Subject: [issue1] Testing...
+To: chef@bork.bork.bork, richard@test
+From: mary <issue_tracker@fill.me.in.>
+Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.>
+MIME-Version: 1.0
+Message-Id: <followup_dummy_id>
+In-Reply-To: <dummy_test_message_id>
+
+
+mary <mary@test> added the comment:
+
+A message with encoding (encoded oe รถ)
+
+----------
+status: unread -> chatting
+___________________________________________________
+"Roundup issue tracker" <issue_tracker@fill.me.in.>
+http://some.useful.url/issue1
+___________________________________________________
+''', 'Generated message not correct')
+
+
def testMultipartEnc01(self):
self.testNewIssue()
message = cStringIO.StringIO('''Content-Type: text/plain;
#
# $Log: not supported by cvs2svn $
+# Revision 1.8 2002/02/04 09:40:21 grubert
+# . add test for multipart messages with first part being encoded.
+#
# Revision 1.7 2002/01/22 11:54:45 rochecompaan
# Fixed status change in mail gateway.
#