summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: acb69fb)
raw | patch | inline | side by side (parent: acb69fb)
author | rochecompaan <rochecompaan@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 21 Jan 2002 10:05:48 +0000 (10:05 +0000) | ||
committer | rochecompaan <rochecompaan@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 21 Jan 2002 10:05:48 +0000 (10:05 +0000) |
. the mail gateway now responds with an error message when invalid
values for arguments are specified for link or multilink properties
. modified unit test to check nosy and assignedto when specified as
arguments
Fixed:
. fixed setting nosy as argument in subject line
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@572 57a73879-2fb5-44c3-a270-3262357dd7e2
values for arguments are specified for link or multilink properties
. modified unit test to check nosy and assignedto when specified as
arguments
Fixed:
. fixed setting nosy as argument in subject line
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@572 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/mailgw.py | patch | blob | history | |
test/test_mailgw.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index 0334d9a6830be91bed9359e1298da5c1b99c534d..67d1cadd746743784c911ddcb792395e9f7c1eb2 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
. journal entries for link and mutlilink properties can be switched on or
off
. properties in change note are now sorted
+ . the mail gateway now responds with an error message when invalid values
+ for arguments are specified for link or mutlilink properties.
+ . modified unit test to check nosy and assignedto when specified as
+ arguments
Fixed:
. handle attachments with no name (eg tnef)
+ . fixed setting nosy as argument in subject line
2002-01-16 - 0.4.0b2
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index 8c81e6abeaee8843ab7faddb9bc162b47ecab0a5..a47db26c0a6e6348a891974ac973aa2c38bf20f1 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.54 2002-01-16 09:14:45 grubert Exp $
+$Id: mailgw.py,v 1.55 2002-01-21 10:05:47 rochecompaan Exp $
'''
Subject was: "%s"
'''%(key, message, subject)
elif isinstance(proptype, hyperdb.Link):
- link = self.db.classes[proptype.classname]
- propkey = link.labelprop(default_to_id=1)
- props[key] = value
+ linkcl = self.db.classes[proptype.classname]
+ propkey = linkcl.labelprop(default_to_id=1)
+ try:
+ props[key] = linkcl.lookup(value)
+ except KeyError, message:
+ raise MailUsageError, '''
+Subject argument list contains an invalid value for %s.
+
+Error was: %s
+Subject was: "%s"
+'''%(key, message, subject)
elif isinstance(proptype, hyperdb.Multilink):
# get the linked class
linkcl = self.db.classes[proptype.classname]
propkey = linkcl.labelprop(default_to_id=1)
for item in value.split(','):
- item = item.split()
+ item = item.strip()
+ try:
+ item = linkcl.lookup(item)
+ except KeyError, message:
+ raise MailUsageError, '''
+Subject argument list contains an invalid value for %s.
+
+Error was: %s
+Subject was: "%s"
+'''%(key, message, subject)
if props.has_key(key):
props[key].append(item)
else:
n[nid] = 1
props['nosy'] = n.keys()
# add assignedto to the nosy list
- try:
- assignedto = self.db.user.lookup(props['assignedto'])
+ if props.has_key('assignedto'):
+ assignedto = props['assignedto']
if assignedto not in props['nosy']:
props['nosy'].append(assignedto)
- except:
- pass
message_id = self.db.msg.create(author=author,
recipients=recipients, date=date.Date('.'), summary=summary,
nosy = props.get('nosy', [])
n = {}
for value in nosy:
- if self.db.hasnode('user', value):
- nid = value
- else:
- continue
+ nid = value
if n.has_key(nid): continue
n[nid] = 1
props['nosy'] = n.keys()
# add assignedto to the nosy list
if properties.has_key('assignedto') and props.has_key('assignedto'):
assignedto = props['assignedto']
- if not re.match('^\d+$', assignedto):
- try:
- assignedto = self.db.user.lookup(assignedto)
- except KeyError:
- raise MailUsageError, '''
-There was a problem with the message you sent:
- Assignedto user '%s' doesn't exist
-'''%props['assignedto']
if not n.has_key(assignedto):
props['nosy'].append(assignedto)
n[assignedto] = 1
#
# $Log: not supported by cvs2svn $
+# Revision 1.54 2002/01/16 09:14:45 grubert
+# . if the attachment has no name, name it unnamed, happens with tnefs.
+#
# Revision 1.53 2002/01/16 07:20:54 richard
# simple help command for mailgw
#
diff --git a/test/test_mailgw.py b/test/test_mailgw.py
index adab1f30b1f8aa0e70d86879703e779763f18df1..0762d0e6b36ec02fdc5d8db059b22fa73685d0c5 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.5 2002-01-15 00:12:40 richard Exp $
+# $Id: test_mailgw.py,v 1.6 2002-01-21 10:05:48 rochecompaan Exp $
import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys
From: Chef <chef@bork.bork.bork
To: issue_tracker@fill.me.in.
Message-Id: <dummy_test_message_id>
-Subject: [issue] Testing... [assignedto=richard]
+Subject: [issue] Testing... [nosy=mary; assignedto=richard]
This is a test submission of a new issue.
''')
self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(),
'''FROM: roundup-admin@fill.me.in.
-TO: chef@bork.bork.bork, richard@test
+TO: chef@bork.bork.bork, mary@test, richard@test
Content-Type: text/plain
Subject: [issue1] Testing...
-To: chef@bork.bork.bork, richard@test
+To: chef@bork.bork.bork, mary@test, richard@test
From: Chef <issue_tracker@fill.me.in.>
Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.>
MIME-Version: 1.0
----------
assignedto: richard
messages: 1
-nosy: Chef, richard
+nosy: mary, Chef, richard
status: unread
title: Testing...
___________________________________________________
To: issue_tracker@fill.me.in.
Message-Id: <followup_dummy_id>
In-Reply-To: <dummy_test_message_id>
-Subject: [issue1] Testing...
+Subject: [issue1] Testing... [assignedto=mary; nosy=john]
This is a followup
''')
self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(),
'''FROM: roundup-admin@fill.me.in.
-TO: chef@bork.bork.bork
+TO: chef@bork.bork.bork, mary@test, john@test
Content-Type: text/plain
Subject: [issue1] Testing...
-To: chef@bork.bork.bork
+To: chef@bork.bork.bork, mary@test, john@test
From: richard <issue_tracker@fill.me.in.>
Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.>
MIME-Version: 1.0
This is a followup
+
+----------
+assignedto: -> mary
+nosy: +mary, john
___________________________________________________
"Roundup issue tracker" <issue_tracker@fill.me.in.>
http://some.useful.url/issue1
#
# $Log: not supported by cvs2svn $
+# Revision 1.5 2002/01/15 00:12:40 richard
+# #503340 ] creating issue with [asignedto=p.ohly]
+#
# Revision 1.4 2002/01/14 07:12:15 richard
# removed file writing from tests...
#