changeset 665:9382ad731c1c

All messages sent to the nosy list are now encoded as quoted-printable.
author Roche Compaan <rochecompaan@users.sourceforge.net>
date Mon, 18 Mar 2002 18:32:00 +0000
parents 9667625a5695
children d1567c2433c4
files CHANGES.txt roundup/roundupdb.py test/test_mailgw.py
diffstat 3 files changed, 39 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Sun Mar 17 23:06:05 2002 +0000
+++ b/CHANGES.txt	Mon Mar 18 18:32:00 2002 +0000
@@ -26,6 +26,8 @@
      field won't exist in most installations, but it will be added to the
      default templates.
  . #517734 ] web header customisation is obscure
+ . All messages sent to the nosy list are now encoded as
+   quoted-printable before they are sent.
 
 Fixed:
  . Clean up mail handling, multipart handling.
--- a/roundup/roundupdb.py	Sun Mar 17 23:06:05 2002 +0000
+++ b/roundup/roundupdb.py	Mon Mar 18 18:32:00 2002 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: roundupdb.py,v 1.47 2002-02-27 03:16:02 richard Exp $
+# $Id: roundupdb.py,v 1.48 2002-03-18 18:32:00 rochecompaan Exp $
 
 __doc__ = """
 Extending hyperdb with types specific to issue-tracking.
@@ -23,7 +23,7 @@
 
 import re, os, smtplib, socket, copy, time, random
 import MimeWriter, cStringIO
-import base64, mimetypes
+import base64, quopri, mimetypes
 
 import hyperdb, date
 
@@ -398,6 +398,13 @@
         if self.db.config.EMAIL_SIGNATURE_POSITION == 'bottom':
             m.append(self.email_signature(nodeid, msgid))
 
+        # encode the content as quoted-printable
+        content = cStringIO.StringIO('\n'.join(m))
+        content_encoded = cStringIO.StringIO()
+        quopri.encode(content, content_encoded, 0)
+        content_encoded.seek(0)
+        content_encoded = content_encoded.read()
+
         # get the files for this message
         message_files = messages.get(msgid, 'files')
 
@@ -423,8 +430,9 @@
         if message_files:
             part = writer.startmultipartbody('mixed')
             part = writer.nextpart()
+            part.addheader('Content-Transfer-Encoding', 'quoted-printable')
             body = part.startbody('text/plain')
-            body.write('\n'.join(m))
+            body.write(content_encoded)
             for fileid in message_files:
                 name = files.get(fileid, 'name')
                 mime_type = files.get(fileid, 'type')
@@ -450,8 +458,9 @@
                     body.write(base64.encodestring(content))
             writer.lastpart()
         else:
+            writer.addheader('Content-Transfer-Encoding', 'quoted-printable')
             body = writer.startbody('text/plain')
-            body.write('\n'.join(m))
+            body.write(content_encoded)
 
         # now try to send the message
         if SENDMAILDEBUG:
@@ -596,6 +605,9 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.47  2002/02/27 03:16:02  richard
+# Fixed a couple of dodgy bits found by pychekcer.
+#
 # Revision 1.46  2002/02/25 14:22:59  grubert
 #  . roundup db: catch only IOError in getfile.
 #
--- a/test/test_mailgw.py	Sun Mar 17 23:06:05 2002 +0000
+++ b/test/test_mailgw.py	Mon Mar 18 18:32:00 2002 +0000
@@ -8,7 +8,7 @@
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
-# $Id: test_mailgw.py,v 1.13 2002-02-15 07:08:45 richard Exp $
+# $Id: test_mailgw.py,v 1.14 2002-03-18 18:32:00 rochecompaan Exp $
 
 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys
 
@@ -45,7 +45,7 @@
         except OSError, error:
             if error.errno not in (errno.ENOENT, errno.ESRCH): raise
 
-    def xtestNewIssue(self):
+    def testNewIssue(self):
         message = cStringIO.StringIO('''Content-Type: text/plain;
   charset="iso-8859-1"
 From: Chef <chef@bork.bork.bork
@@ -81,7 +81,7 @@
         self.assertEqual(userlist, self.db.user.list(),
             "user created when it shouldn't have been")
 
-    def xtestNewIssueNoClass(self):
+    def testNewIssueNoClass(self):
         message = cStringIO.StringIO('''Content-Type: text/plain;
   charset="iso-8859-1"
 From: Chef <chef@bork.bork.bork
@@ -98,7 +98,7 @@
             error = open(os.environ['SENDMAILDEBUG']).read()
             self.assertEqual('no error', error)
 
-    def xtestNewIssueAuthMsg(self):
+    def testNewIssueAuthMsg(self):
         message = cStringIO.StringIO('''Content-Type: text/plain;
   charset="iso-8859-1"
 From: Chef <chef@bork.bork.bork
@@ -124,6 +124,7 @@
 MIME-Version: 1.0
 Message-Id: <dummy_test_message_id>
 X-Roundup-Name: Roundup issue tracker
+Content-Transfer-Encoding: quoted-printable
 
 
 New submission from Chef <chef@bork.bork.bork>:
@@ -152,7 +153,7 @@
 
     # BUG should test some binary attamchent too.
 
-    def xtestFollowup(self):
+    def testFollowup(self):
         self.testNewIssue()
         message = cStringIO.StringIO('''Content-Type: text/plain;
   charset="iso-8859-1"
@@ -179,6 +180,7 @@
 Message-Id: <followup_dummy_id>
 In-Reply-To: <dummy_test_message_id>
 X-Roundup-Name: Roundup issue tracker
+Content-Transfer-Encoding: quoted-printable
 
 
 richard <richard@test> added the comment:
@@ -196,7 +198,7 @@
 ___________________________________________________
 ''', 'Generated message not correct')
 
-    def xtestFollowup2(self):
+    def testFollowup2(self):
         self.testNewIssue()
         message = cStringIO.StringIO('''Content-Type: text/plain;
   charset="iso-8859-1"
@@ -222,6 +224,7 @@
 Message-Id: <followup_dummy_id>
 In-Reply-To: <dummy_test_message_id>
 X-Roundup-Name: Roundup issue tracker
+Content-Transfer-Encoding: quoted-printable
 
 
 mary <mary@test> added the comment:
@@ -237,7 +240,7 @@
 ___________________________________________________
 ''', 'Generated message not correct')
 
-    def xtestFollowupTitleMatch(self):
+    def testFollowupTitleMatch(self):
         self.testNewIssue()
         message = cStringIO.StringIO('''Content-Type: text/plain;
   charset="iso-8859-1"
@@ -264,6 +267,7 @@
 Message-Id: <followup_dummy_id>
 In-Reply-To: <dummy_test_message_id>
 X-Roundup-Name: Roundup issue tracker
+Content-Transfer-Encoding: quoted-printable
 
 
 richard <richard@test> added the comment:
@@ -281,7 +285,7 @@
 ___________________________________________________
 ''') #, 'Generated message not correct')
 
-    def xtestEnc01(self):
+    def testEnc01(self):
         self.testNewIssue()
         message = cStringIO.StringIO('''Content-Type: text/plain;
   charset="iso-8859-1"
@@ -312,11 +316,12 @@
 Message-Id: <followup_dummy_id>
 In-Reply-To: <dummy_test_message_id>
 X-Roundup-Name: Roundup issue tracker
+Content-Transfer-Encoding: quoted-printable
 
 
 mary <mary@test> added the comment:
 
-A message with encoding (encoded oe ö)
+A message with encoding (encoded oe =F6)
 
 ----------
 status: unread -> chatting
@@ -327,7 +332,7 @@
 ''', 'Generated message not correct')
 
 
-    def xtestMultipartEnc01(self):
+    def testMultipartEnc01(self):
         self.testNewIssue()
         message = cStringIO.StringIO('''Content-Type: text/plain;
   charset="iso-8859-1"
@@ -365,11 +370,12 @@
 Message-Id: <followup_dummy_id>
 In-Reply-To: <dummy_test_message_id>
 X-Roundup-Name: Roundup issue tracker
+Content-Transfer-Encoding: quoted-printable
 
 
 mary <mary@test> added the comment:
 
-A message with first part encoded (encoded oe ö)
+A message with first part encoded (encoded oe =F6)
 
 ----------
 status: unread -> chatting
@@ -391,6 +397,10 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.13  2002/02/15 07:08:45  richard
+#  . Alternate email addresses are now available for users. See the MIGRATION
+#    file for info on how to activate the feature.
+#
 # Revision 1.12  2002/02/15 00:13:38  richard
 #  . #503204 ] mailgw needs a default class
 #     - partially done - the setting of additional properties can wait for a

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