Skip to content

Commit cb4b4ea

Browse files
author
Richard Jones
committed
set title on issues even when the email body is empty [SF#727430]
1 parent 99f3175 commit cb4b4ea

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ Fixed:
8787
- added creation to index columns (sf bug 708247)
8888
- fixed missing (pre-commit) journal entries in *dbm backends (sf bug 679217)
8989
- URL cited in roundup email confusing dumb Email clients (sf bug 716585)
90+
- set title on issues even when the email body is empty (sf bug 727430)
9091

9192

9293
2003-??-?? 0.5.7

roundup/mailgw.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class node. Any parts of other types are each stored in separate files
7373
an exception, the original message is bounced back to the sender with the
7474
explanatory message given in the exception.
7575
76-
$Id: mailgw.py,v 1.120 2003-04-24 20:30:37 kedder Exp $
76+
$Id: mailgw.py,v 1.121 2003-04-27 02:16:46 richard Exp $
7777
'''
7878

7979
import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
@@ -571,7 +571,6 @@ def handle_message(self, message):
571571
Subject was: "%s"
572572
'''%(nodeid, subject)
573573

574-
575574
# Handle the arguments specified by the email gateway command line.
576575
# We do this by looping over the list of self.arguments looking for
577576
# a -C to tell us what class then the -S setting string.
@@ -679,11 +678,6 @@ def handle_message(self, message):
679678
if recipient:
680679
recipients.append(recipient)
681680

682-
#
683-
# XXX extract the args NOT USED WHY -- rouilj
684-
#
685-
subject_args = m.group('args')
686-
687681
#
688682
# handle the subject argument list
689683
#
@@ -703,6 +697,11 @@ def handle_message(self, message):
703697
Subject was: "%s"
704698
'''%(errors, subject)
705699

700+
701+
# set the issue title to the subject
702+
if properties.has_key('title') and not issue_props.has_key('title'):
703+
issue_props['title'] = title.strip()
704+
706705
#
707706
# handle message-id and in-reply-to
708707
#
@@ -876,10 +875,6 @@ def handle_message(self, message):
876875
# pre-load the messages list
877876
props['messages'] = [message_id]
878877

879-
# set the title to the subject
880-
if properties.has_key('title') and not props.has_key('title'):
881-
props['title'] = title
882-
883878
#
884879
# perform the node change / create
885880
#

test/test_mailgw.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# but WITHOUT ANY WARRANTY; without even the implied warranty of
99
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1010
#
11-
# $Id: test_mailgw.py,v 1.44 2003-04-17 06:51:44 richard Exp $
11+
# $Id: test_mailgw.py,v 1.45 2003-04-27 02:16:47 richard Exp $
1212

1313
import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib
1414
import rfc822
@@ -95,6 +95,24 @@ def tearDown(self):
9595
except OSError, error:
9696
if error.errno not in (errno.ENOENT, errno.ESRCH): raise
9797

98+
def testEmptyMessage(self):
99+
message = cStringIO.StringIO('''Content-Type: text/plain;
100+
charset="iso-8859-1"
101+
From: Chef <[email protected]>
102+
103+
Cc: richard@test
104+
Message-Id: <dummy_test_message_id>
105+
Subject: [issue] Testing...
106+
107+
''')
108+
handler = self.instance.MailGW(self.instance, self.db)
109+
handler.trapExceptions = 0
110+
nodeid = handler.main(message)
111+
if os.path.exists(os.environ['SENDMAILDEBUG']):
112+
error = open(os.environ['SENDMAILDEBUG']).read()
113+
self.assertEqual('no error', error)
114+
self.assertEqual(self.db.issue.get(nodeid, 'title'), 'Testing...')
115+
98116
def doNewIssue(self):
99117
message = cStringIO.StringIO('''Content-Type: text/plain;
100118
charset="iso-8859-1"

0 commit comments

Comments
 (0)