summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6d0cb35)
raw | patch | inline | side by side (parent: 6d0cb35)
author | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 3 Nov 2003 18:34:03 +0000 (18:34 +0000) | ||
committer | jlgijsbers <jlgijsbers@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 3 Nov 2003 18:34:03 +0000 (18:34 +0000) |
mail gateway.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1956 57a73879-2fb5-44c3-a270-3262357dd7e2
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1956 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/mailgw.py | patch | blob | history | |
test/test_mailgw.py | patch | blob | history |
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index 544ef29b16bc329f49ec8cd3ed0e16dc26ecc339..ab03bda4e1fbb2db97200ae80d4e1d61b066398b 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.135 2003-10-25 12:03:41 jlgijsbers Exp $
+$Id: mailgw.py,v 1.136 2003-11-03 18:34:03 jlgijsbers Exp $
"""
import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
#
# handle the attachments
#
- files = []
- for (name, mime_type, data) in attachments:
- if not name:
- name = "unnamed"
- files.append(self.db.file.create(type=mime_type, name=name,
- content=data, **file_props))
- # attach the files to the issue
- if nodeid:
- # extend the existing files list
- fileprop = cl.get(nodeid, 'files')
- fileprop.extend(files)
- props['files'] = fileprop
- else:
- # pre-load the files list
- props['files'] = files
-
+ if properties.has_key('files'):
+ files = []
+ for (name, mime_type, data) in attachments:
+ if not name:
+ name = "unnamed"
+ files.append(self.db.file.create(type=mime_type, name=name,
+ content=data, **file_props))
+ # attach the files to the issue
+ if nodeid:
+ # extend the existing files list
+ fileprop = cl.get(nodeid, 'files')
+ fileprop.extend(files)
+ props['files'] = fileprop
+ else:
+ # pre-load the files list
+ props['files'] = files
#
# create the message if there's a message body (content)
#
- if content:
+ if (content and properties.has_key('messages')):
message_id = self.db.msg.create(author=author,
recipients=recipients, date=date.Date('.'), summary=summary,
content=content, files=files, messageid=messageid,
diff --git a/test/test_mailgw.py b/test/test_mailgw.py
index ea5adde2dc93d70213e78737bc0895211c5595fc..137d7a24d2d16e58a4a91abf22b109d8ad655203 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.57 2003-10-25 22:53:26 richard Exp $
+# $Id: test_mailgw.py,v 1.58 2003-11-03 18:34:03 jlgijsbers Exp $
import unittest, tempfile, os, shutil, errno, imp, sys, difflib, rfc822
self.db.user.lookup('johannes')
+ def testFollowupOnNonIssue(self):
+ self.db.keyword.create(name='Foo')
+ message = StringIO('''Content-Type: text/plain;
+ charset="iso-8859-1"
+From: richard <richard@test>
+To: issue_tracker@your.tracker.email.domain.example
+Message-Id: <followup_dummy_id>
+In-Reply-To: <dummy_test_message_id>
+Subject: [keyword1] Testing... [name=Bar]
+
+''')
+ handler = self.instance.MailGW(self.instance, self.db)
+ handler.trapExceptions = 0
+ handler.main(message)
+
+ self.assertEqual(self.db.keyword.get('1', 'name'), 'Bar')
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(MailgwTestCase))