summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 47d9a33)
raw | patch | inline | side by side (parent: 47d9a33)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 15 Jan 2002 00:12:40 +0000 (00:12 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 15 Jan 2002 00:12:40 +0000 (00:12 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@549 57a73879-2fb5-44c3-a270-3262357dd7e2
CHANGES.txt | patch | blob | history | |
roundup/mailgw.py | patch | blob | history | |
roundup/roundupdb.py | patch | blob | history | |
test/test_mailgw.py | patch | blob | history |
diff --git a/CHANGES.txt b/CHANGES.txt
index d7bc7d698532dce79c205003b554b6b9befda1ef..62e1fedaa32e59832cc13f96772fbbade61005d0 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
. #503330 ] ANONYMOUS_REGISTER now applies to mail
. #503353 ] setting properties in initial email
. #502956 ] filtering by multilink not supported
. #503330 ] ANONYMOUS_REGISTER now applies to mail
. #503353 ] setting properties in initial email
. #502956 ] filtering by multilink not supported
+ . #503340 ] creating issue with [asignedto=p.ohly]
2002-01-08 - 0.4.0b1
2002-01-08 - 0.4.0b1
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index 0dc5a737a213a48de39f4977e12a5f22aac4d192..66f91cad054abfd8649b2e21b1e51abcb0907008 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.
an exception, the original message is bounced back to the sender with the
explanatory message given in the exception.
-$Id: mailgw.py,v 1.51 2002-01-14 02:20:15 richard Exp $
+$Id: mailgw.py,v 1.52 2002-01-15 00:12:40 richard Exp $
'''
'''
args = m.group('args')
if args:
for prop in string.split(args, ';'):
args = m.group('args')
if args:
for prop in string.split(args, ';'):
+ # extract the property name and value
try:
key, value = prop.split('=')
except ValueError, message:
try:
key, value = prop.split('=')
except ValueError, message:
Subject was: "%s"
'''%(message, subject)
Subject was: "%s"
'''%(message, subject)
+
+ # ensure it's a valid property name
key = key.strip()
try:
proptype = properties[key]
key = key.strip()
try:
proptype = properties[key]
Subject was: "%s"
'''%(key, subject)
Subject was: "%s"
'''%(key, subject)
+
+ # convert the string value to a real property value
if isinstance(proptype, hyperdb.String):
props[key] = value.strip()
if isinstance(proptype, hyperdb.Password):
if isinstance(proptype, hyperdb.String):
props[key] = value.strip()
if isinstance(proptype, hyperdb.Password):
elif isinstance(proptype, hyperdb.Link):
link = self.db.classes[proptype.classname]
propkey = link.labelprop(default_to_id=1)
elif isinstance(proptype, hyperdb.Link):
link = self.db.classes[proptype.classname]
propkey = link.labelprop(default_to_id=1)
- try:
- props[key] = link.get(value.strip(), propkey)
- except:
- props[key] = link.lookup(value.strip())
+ props[key] = value
elif isinstance(proptype, hyperdb.Multilink):
elif isinstance(proptype, hyperdb.Multilink):
- link = self.db.classes[proptype.classname]
- propkey = link.labelprop(default_to_id=1)
- l = [x.strip() for x in value.split(',')]
- for item in l:
- try:
- v = link.get(item, propkey)
- except:
- v = link.lookup(item)
+ # 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()
if props.has_key(key):
if props.has_key(key):
- props[key].append(v)
+ props[key].append(item)
else:
else:
- props[key] = [v]
+ props[key] = [item]
#
# handle the users
#
# handle the users
# add assignedto to the nosy list
if properties.has_key('assignedto') and props.has_key('assignedto'):
# add assignedto to the nosy list
if properties.has_key('assignedto') and props.has_key('assignedto'):
- try:
- assignedto = self.db.user.lookup(props['assignedto'])
- except KeyError:
- raise MailUsageError, '''
+ 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']
There was a problem with the message you sent:
Assignedto user '%s' doesn't exist
'''%props['assignedto']
#
# $Log: not supported by cvs2svn $
#
# $Log: not supported by cvs2svn $
+# Revision 1.51 2002/01/14 02:20:15 richard
+# . changed all config accesses so they access either the instance or the
+# config attriubute on the db. This means that all config is obtained from
+# instance_config instead of the mish-mash of classes. This will make
+# switching to a ConfigParser setup easier too, I hope.
+#
+# At a minimum, this makes migration a _little_ easier (a lot easier in the
+# 0.5.0 switch, I hope!)
+#
# Revision 1.50 2002/01/11 22:59:01 richard
# . #502342 ] pipe interface
#
# Revision 1.50 2002/01/11 22:59:01 richard
# . #502342 ] pipe interface
#
diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py
index 0238be6ae7016c0af728edd07a83e5918cb460af..c2aeafef6fec1129d52186001cbc43c88f815b3a 100644 (file)
--- a/roundup/roundupdb.py
+++ b/roundup/roundupdb.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: roundupdb.py,v 1.40 2002-01-14 22:21:38 richard Exp $
+# $Id: roundupdb.py,v 1.41 2002-01-15 00:12:40 richard Exp $
__doc__ = """
Extending hyperdb with types specific to issue-tracking.
__doc__ = """
Extending hyperdb with types specific to issue-tracking.
# list the values
m = []
# list the values
m = []
- for propname, prop in props.items():
+ l = props.items()
+ l.sort()
+ for propname, prop in l:
value = cl.get(nodeid, propname, None)
value = cl.get(nodeid, propname, None)
+ # skip boring entries
+ if not value:
+ continue
if isinstance(prop, hyperdb.Link):
link = self.db.classes[prop.classname]
if value:
if isinstance(prop, hyperdb.Link):
link = self.db.classes[prop.classname]
if value:
#
# $Log: not supported by cvs2svn $
#
# $Log: not supported by cvs2svn $
+# Revision 1.40 2002/01/14 22:21:38 richard
+# #503353 ] setting properties in initial email
+#
# Revision 1.39 2002/01/14 02:20:15 richard
# . changed all config accesses so they access either the instance or the
# config attriubute on the db. This means that all config is obtained from
# Revision 1.39 2002/01/14 02:20:15 richard
# . changed all config accesses so they access either the instance or the
# config attriubute on the db. This means that all config is obtained from
diff --git a/test/test_mailgw.py b/test/test_mailgw.py
index cbaf7a5852cc8ec59fdfbd36bf35543fb38d7275..adab1f30b1f8aa0e70d86879703e779763f18df1 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.
#
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
-# $Id: test_mailgw.py,v 1.4 2002-01-14 07:12:15 richard Exp $
+# $Id: test_mailgw.py,v 1.5 2002-01-15 00:12:40 richard Exp $
import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys
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>
From: Chef <chef@bork.bork.bork
To: issue_tracker@fill.me.in.
Message-Id: <dummy_test_message_id>
-Subject: [issue] Testing...
+Subject: [issue] Testing... [assignedto=richard]
This is a test submission of a new issue.
''')
This is a test submission of a new issue.
''')
self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(),
'''FROM: roundup-admin@fill.me.in.
self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(),
'''FROM: roundup-admin@fill.me.in.
-TO: chef@bork.bork.bork
+TO: chef@bork.bork.bork, richard@test
Content-Type: text/plain
Subject: [issue1] Testing...
Content-Type: text/plain
Subject: [issue1] Testing...
-To: chef@bork.bork.bork
+To: chef@bork.bork.bork, richard@test
From: Chef <issue_tracker@fill.me.in.>
Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.>
MIME-Version: 1.0
From: Chef <issue_tracker@fill.me.in.>
Reply-To: Roundup issue tracker <issue_tracker@fill.me.in.>
MIME-Version: 1.0
This is a test submission of a new issue.
This is a test submission of a new issue.
+
+----------
+assignedto: richard
+messages: 1
+nosy: Chef, richard
+status: unread
+title: Testing...
___________________________________________________
"Roundup issue tracker" <issue_tracker@fill.me.in.>
http://some.useful.url/issue1
___________________________________________________
___________________________________________________
"Roundup issue tracker" <issue_tracker@fill.me.in.>
http://some.useful.url/issue1
___________________________________________________
-''', 'Generated message not correct')
+''')
def testFollowup(self):
self.testNewIssue()
def testFollowup(self):
self.testNewIssue()
This is a followup
''')
handler = self.instance.MailGW(self.instance, self.db)
This is a followup
''')
handler = self.instance.MailGW(self.instance, self.db)
- # TODO: fix the damn config - this is apalling
handler.main(message)
self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(),
handler.main(message)
self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(),
This is a second followup
''')
handler = self.instance.MailGW(self.instance, self.db)
This is a second followup
''')
handler = self.instance.MailGW(self.instance, self.db)
- # TODO: fix the damn config - this is apalling
handler.main(message)
self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(),
'''FROM: roundup-admin@fill.me.in.
handler.main(message)
self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(),
'''FROM: roundup-admin@fill.me.in.
def suite():
l = [unittest.makeSuite(MailgwTestCase, 'test'),
def suite():
l = [unittest.makeSuite(MailgwTestCase, 'test'),
- unittest.makeSuite(ExtMailgwTestCase, 'test')]
+ unittest.makeSuite(ExtMailgwTestCase, 'test')
+ ]
return unittest.TestSuite(l)
#
# $Log: not supported by cvs2svn $
return unittest.TestSuite(l)
#
# $Log: not supported by cvs2svn $
+# Revision 1.4 2002/01/14 07:12:15 richard
+# removed file writing from tests...
+#
# Revision 1.3 2002/01/14 02:20:15 richard
# . changed all config accesses so they access either the instance or the
# config attriubute on the db. This means that all config is obtained from
# Revision 1.3 2002/01/14 02:20:15 richard
# . changed all config accesses so they access either the instance or the
# config attriubute on the db. This means that all config is obtained from