From e9a26effed8495aa409a4bca11c514af91525048 Mon Sep 17 00:00:00 2001 From: richard Date: Sun, 27 Apr 2003 02:16:48 +0000 Subject: [PATCH] set title on issues even when the email body is empty (sf bug 727430) git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1687 57a73879-2fb5-44c3-a270-3262357dd7e2 --- CHANGES.txt | 1 + roundup/mailgw.py | 17 ++++++----------- test/test_mailgw.py | 20 +++++++++++++++++++- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 1d294f6..ef60af1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -87,6 +87,7 @@ Fixed: - 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 diff --git a/roundup/mailgw.py b/roundup/mailgw.py index 3e6cb8e..ca9ed5a 100644 --- a/roundup/mailgw.py +++ b/roundup/mailgw.py @@ -73,7 +73,7 @@ are calling the create() method to create a new node). If an auditor raises 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 @@ does not exist. 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. @@ -679,11 +678,6 @@ Unknown address: %s if recipient: recipients.append(recipient) - # - # XXX extract the args NOT USED WHY -- rouilj - # - subject_args = m.group('args') - # # handle the subject argument list # @@ -703,6 +697,11 @@ There were problems handling your subject line argument list: 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 @@ not find a text/plain part to use. # 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 # diff --git a/test/test_mailgw.py b/test/test_mailgw.py index 138059b..d524b78 100644 --- a/test/test_mailgw.py +++ b/test/test_mailgw.py @@ -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 @@ class MailgwTestCase(unittest.TestCase, DiffHelper): 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 +To: issue_tracker@your.tracker.email.domain.example +Cc: richard@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" -- 2.30.2