changeset 1620:fc9dafcb62e0

set title on issues even when the email body is empty [SF#727430]
author Richard Jones <richard@users.sourceforge.net>
date Sun, 27 Apr 2003 02:16:48 +0000
parents 7034b61e9d9e
children b3abda04a690
files CHANGES.txt roundup/mailgw.py test/test_mailgw.py
diffstat 3 files changed, 26 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Fri Apr 25 02:09:20 2003 +0000
+++ b/CHANGES.txt	Sun Apr 27 02:16:48 2003 +0000
@@ -87,6 +87,7 @@
 - added creation to index columns (sf bug 708247)
 - fixed missing (pre-commit) journal entries in *dbm backends (sf bug 679217)
 - URL cited in roundup email confusing dumb Email clients (sf bug 716585)
+- set title on issues even when the email body is empty (sf bug 727430)
 
 
 2003-??-?? 0.5.7
--- a/roundup/mailgw.py	Fri Apr 25 02:09:20 2003 +0000
+++ b/roundup/mailgw.py	Sun Apr 27 02:16:48 2003 +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.120 2003-04-24 20:30:37 kedder Exp $
+$Id: mailgw.py,v 1.121 2003-04-27 02:16:46 richard Exp $
 '''
 
 import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
@@ -571,7 +571,6 @@
 Subject was: "%s"
 '''%(nodeid, subject)
 
-
         # Handle the arguments specified by the email gateway command line.
         # We do this by looping over the list of self.arguments looking for
         # a -C to tell us what class then the -S setting string.
@@ -680,11 +679,6 @@
                 recipients.append(recipient)
 
         #
-        # XXX extract the args NOT USED WHY -- rouilj
-        #
-        subject_args = m.group('args')
-
-        #
         # handle the subject argument list
         #
         # figure what the properties of this Class are
@@ -703,6 +697,11 @@
 Subject was: "%s"
 '''%(errors, subject)
 
+
+        # set the issue title to the subject
+        if properties.has_key('title') and not issue_props.has_key('title'):
+            issue_props['title'] = title.strip()
+
         #
         # handle message-id and in-reply-to
         #
@@ -876,10 +875,6 @@
                 # pre-load the messages list
                 props['messages'] = [message_id]
 
-                # set the title to the subject
-                if properties.has_key('title') and not props.has_key('title'):
-                    props['title'] = title
-
         #
         # perform the node change / create
         #
--- a/test/test_mailgw.py	Fri Apr 25 02:09:20 2003 +0000
+++ b/test/test_mailgw.py	Sun Apr 27 02:16:48 2003 +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.44 2003-04-17 06:51:44 richard Exp $
+# $Id: test_mailgw.py,v 1.45 2003-04-27 02:16:47 richard Exp $
 
 import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib
 import rfc822
@@ -95,6 +95,24 @@
         except OSError, error:
             if error.errno not in (errno.ENOENT, errno.ESRCH): raise
 
+    def testEmptyMessage(self):
+        message = cStringIO.StringIO('''Content-Type: text/plain;
+  charset="iso-8859-1"
+From: Chef <chef@bork.bork.bork>
+To: issue_tracker@your.tracker.email.domain.example
+Cc: richard@test
+Message-Id: <dummy_test_message_id>
+Subject: [issue] Testing...
+
+''')
+        handler = self.instance.MailGW(self.instance, self.db)
+        handler.trapExceptions = 0
+        nodeid = handler.main(message)
+        if os.path.exists(os.environ['SENDMAILDEBUG']):
+            error = open(os.environ['SENDMAILDEBUG']).read()
+            self.assertEqual('no error', error)
+        self.assertEqual(self.db.issue.get(nodeid, 'title'), 'Testing...')
+
     def doNewIssue(self):
         message = cStringIO.StringIO('''Content-Type: text/plain;
   charset="iso-8859-1"

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