summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d225599)
raw | patch | inline | side by side (parent: d225599)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 15 Feb 2002 00:13:38 +0000 (00:13 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 15 Feb 2002 00:13:38 +0000 (00:13 +0000) |
- partially done - the setting of additional properties can wait for a
better configuration system.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@628 57a73879-2fb5-44c3-a270-3262357dd7e2
better configuration system.
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@628 57a73879-2fb5-44c3-a270-3262357dd7e2
diff --git a/CHANGES.txt b/CHANGES.txt
index 6a7ba2271e328a989fb3dc7a28bcddb4b8bafbb8..8f5716e2896d96e9f7759341f1fc0af96a2805a2 100644 (file)
--- a/CHANGES.txt
+++ b/CHANGES.txt
are given with the most recent entry first.
2002-02-?? - 0.4.1
+Feature:
+ . #503204 ] mailgw needs a default class
+ - partially done - the setting of additional properties can wait for a
+ better configuration system.
+
Fixed:
. Clean up mail handling, multipart handling.
. respect encodings in non multipart messages.
on the client-side.
. #516883 ] mail interface + ANONYMOUS_REGISTER
+
2002-01-24 - 0.4.0
Feature:
. much nicer history display (actualy real handling of property types etc)
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index b3bda148934ca24c3ed115e77c1d1f3482219db1..3898051e4aa5b30229f4f77611126b3d190e9aa5 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.64 2002-02-14 23:46:02 richard Exp $
+$Id: mailgw.py,v 1.65 2002-02-15 00:13:38 richard Exp $
'''
return Message(s)
subject_re = re.compile(r'(?P<refwd>\s*\W?\s*(fwd|re|aw)\s*\W?\s*)*'
- r'\s*(\[(?P<classname>[^\d\s]+)(?P<nodeid>\d+)?\])'
+ r'\s*(\[(?P<classname>[^\d\s]+)(?P<nodeid>\d+)?\])?'
r'\s*(?P<title>[^[]+)?(\[(?P<args>.+?)\])?', re.I)
class MailGW:
raise MailUsageHelp
m = subject_re.match(subject)
+
+ # check for well-formed subject line
+ if m:
+ # get the classname
+ classname = m.group('classname')
+ if classname is None:
+ # no classname, fallback on the default
+ if hasattr(self.instance, 'MAIL_DEFAULT_CLASS') and \
+ self.instance.MAIL_DEFAULT_CLASS:
+ classname = self.instance.MAIL_DEFAULT_CLASS
+ else:
+ # fail
+ m = None
+
if not m:
raise MailUsageError, '''
The message you sent to roundup did not contain a properly formed subject
Subject was: "%s"
'''%subject
- # get the classname
- classname = m.group('classname')
+ # get the class
try:
cl = self.db.getclass(classname)
except KeyError:
#
# $Log: not supported by cvs2svn $
+# Revision 1.64 2002/02/14 23:46:02 richard
+# . #516883 ] mail interface + ANONYMOUS_REGISTER
+#
# Revision 1.63 2002/02/12 08:08:55 grubert
# . Clean up mail handling, multipart handling.
#
diff --git a/roundup/templates/classic/instance_config.py b/roundup/templates/classic/instance_config.py
index e36d1bbfd6a2b75d2063ede134c165358f5b817c..0fe747d99657c30b71e4491309a1c67c5dbe7cd3 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: instance_config.py,v 1.11 2002-02-14 23:46:02 richard Exp $
+# $Id: instance_config.py,v 1.12 2002-02-15 00:13:38 richard Exp $
MAIL_DOMAIN=MAILHOST=HTTP_HOST=None
HTTP_PORT=0
# Where to place the email signature
EMAIL_SIGNATURE_POSITION = 'bottom'
+# Default class to use in the mailgw if one isn't supplied in email
+# subjects. To disable, comment out the variable below or leave it blank.
+# Examples:
+MAIL_DEFAULT_CLASS = 'issue' # use "issue" class by default
+#MAIL_DEFAULT_CLASS = '' # disable (or just comment the var out)
+
#
# $Log: not supported by cvs2svn $
+# Revision 1.11 2002/02/14 23:46:02 richard
+# . #516883 ] mail interface + ANONYMOUS_REGISTER
+#
# Revision 1.10 2001/11/26 22:55:56 richard
# Feature:
# . Added INSTANCE_NAME to configuration - used in web and email to identify
diff --git a/roundup/templates/extended/instance_config.py b/roundup/templates/extended/instance_config.py
index f3ddcd1bbb03b7b80121fee7af5bda8ebdebdf17..89f3268cdc3ed525634b9fdf787a27ee914fa673 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: instance_config.py,v 1.11 2002-02-14 23:46:02 richard Exp $
+# $Id: instance_config.py,v 1.12 2002-02-15 00:13:38 richard Exp $
MAIL_DOMAIN=MAILHOST=HTTP_HOST=None
HTTP_PORT=0
FILTER_POSITION = 'bottom' # one of 'top', 'bottom', 'top and bottom'
# Deny or allow anonymous access to the web interface
-ANONYMOUS_ACCESS = 'deny'
+ANONYMOUS_ACCESS = 'deny' # either 'deny' or 'allow'
# Deny or allow anonymous users to register through the web interface
-ANONYMOUS_REGISTER = 'deny'
+ANONYMOUS_REGISTER = 'deny' # either 'deny' or 'allow'
# Deny or allow anonymous users to register through the mail interface
-ANONYMOUS_REGISTER_MAIL = 'deny'
+ANONYMOUS_REGISTER_MAIL = 'deny' # either 'deny' or 'allow'
# Send nosy messages to the author of the message
MESSAGES_TO_AUTHOR = 'no' # either 'yes' or 'no'
# Where to place the email signature
EMAIL_SIGNATURE_POSITION = 'bottom'
+# Default class to use in the mailgw if one isn't supplied in email
+# subjects. To disable, comment out the variable below or leave it blank.
+# Examples:
+MAIL_DEFAULT_CLASS = 'issue' # use "issue" class by default
+#MAIL_DEFAULT_CLASS = '' # disable (or just comment the var out)
+
#
# $Log: not supported by cvs2svn $
+# Revision 1.11 2002/02/14 23:46:02 richard
+# . #516883 ] mail interface + ANONYMOUS_REGISTER
+#
# Revision 1.10 2001/11/26 22:55:56 richard
# Feature:
# . Added INSTANCE_NAME to configuration - used in web and email to identify
diff --git a/test/test_mailgw.py b/test/test_mailgw.py
index 58dda70f399fbabc71ddd27110557e01f7816fa6..f877a1d008f9e84e13997a0f91df81035395b2ce 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.11 2002-02-14 23:38:12 richard Exp $
+# $Id: test_mailgw.py,v 1.12 2002-02-15 00:13:38 richard Exp $
import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys
Message-Id: <dummy_test_message_id>
Subject: [issue] Testing...
+This is a test submission of a new issue.
+''')
+ handler = self.instance.MailGW(self.instance, self.db)
+ handler.main(message)
+ if os.path.exists(os.environ['SENDMAILDEBUG']):
+ error = open(os.environ['SENDMAILDEBUG']).read()
+ self.assertEqual('no error', error)
+
+ def testNewIssueNoClass(self):
+ message = cStringIO.StringIO('''Content-Type: text/plain;
+ charset="iso-8859-1"
+From: Chef <chef@bork.bork.bork
+To: issue_tracker@fill.me.in.
+Cc: richard@test
+Message-Id: <dummy_test_message_id>
+Subject: Testing...
+
This is a test submission of a new issue.
''')
handler = self.instance.MailGW(self.instance, self.db)
"Roundup issue tracker" <issue_tracker@fill.me.in.>
http://some.useful.url/issue1
___________________________________________________
-''')
+''', 'Generated message not correct')
# BUG
# def testMultipart(self):
- # '''With more than one part'''
- # see MultipartEnc tests: but if there is more than one part
- # we return a multipart/mixed and the boundary contains
- # the ip address of the test machine.
+ # '''With more than one part'''
+ # see MultipartEnc tests: but if there is more than one part
+ # we return a multipart/mixed and the boundary contains
+ # the ip address of the test machine.
# BUG should test some binary attamchent too.
___________________________________________________
''', 'Generated message not correct')
+ def testFollowupTitleMatch(self):
+ self.testNewIssue()
+ message = cStringIO.StringIO('''Content-Type: text/plain;
+ charset="iso-8859-1"
+From: richard <richard@test>
+To: issue_tracker@fill.me.in.
+Message-Id: <followup_dummy_id>
+In-Reply-To: <dummy_test_message_id>
+Subject: Re: Testing... [assignedto=mary; nosy=john]
+
+This is a followup
+''')
+ handler = self.instance.MailGW(self.instance, self.db)
+ handler.main(message)
+
+ self.assertEqual(open(os.environ['SENDMAILDEBUG']).read(),
+'''FROM: roundup-admin@fill.me.in.
+TO: chef@bork.bork.bork, mary@test, john@test
+Content-Type: text/plain
+Subject: [issue1] Testing...
+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
+Message-Id: <followup_dummy_id>
+In-Reply-To: <dummy_test_message_id>
+X-Roundup-Name: Roundup issue tracker
+
+
+richard <richard@test> added the comment:
+
+This is a followup
+
+
+----------
+assignedto: -> mary
+nosy: +mary, john
+status: unread -> chatting
+___________________________________________________
+"Roundup issue tracker" <issue_tracker@fill.me.in.>
+http://some.useful.url/issue1
+___________________________________________________
+''') #, 'Generated message not correct')
+
def testEnc01(self):
self.testNewIssue()
message = cStringIO.StringIO('''Content-Type: text/plain;
def suite():
l = [unittest.makeSuite(MailgwTestCase, 'test'),
- unittest.makeSuite(ExtMailgwTestCase, 'test')
+ unittest.makeSuite(ExtMailgwTestCase, 'test')
]
return unittest.TestSuite(l)
#
# $Log: not supported by cvs2svn $
+# Revision 1.11 2002/02/14 23:38:12 richard
+# Fixed the unit tests for the mailgw re: the x-roundup-name header.
+# Also made the test runner more user-friendly:
+# ./run_tests - detect all tests in test/test_<name>.py and run them
+# ./run_tests <name> - run only test/test_<name>.py
+# eg ./run_tests mailgw - run the mailgw test from test/test_mailgw.py
+#
# Revision 1.10 2002/02/12 08:08:55 grubert
# . Clean up mail handling, multipart handling.
#