changeset 3724:b4d655b2aacf

E-mail subject line prefix delimiter configuration was being ignored
author Richard Jones <richard@users.sourceforge.net>
date Thu, 05 Oct 2006 23:08:21 +0000
parents e0d13120a330
children 65badf6ab7ad
files CHANGES.txt roundup/__init__.py roundup/mailgw.py test/test_mailgw.py
diffstat 4 files changed, 32 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Thu Oct 05 21:14:57 2006 +0000
+++ b/CHANGES.txt	Thu Oct 05 23:08:21 2006 +0000
@@ -1,6 +1,11 @@
 This file contains the changes to the Roundup system over time. The entries
 are given with the most recent entry first.
 
+2006-??-?? 1.2.1
+Fixed:
+- E-mail subject line prefix delimiter configuration was being ignored.
+
+
 2006-10-04 1.2.0
 Feature:
 - supports Python 2.5, including the sqlite3 module
@@ -52,7 +57,7 @@
 - Bug with name-collisions in sorted classes when sorting by Link
   properties in metakit backend fixed
 - Postgres backend allows transaction collisions to be ignored when
-  committing clenup in the sessions database
+  committing cleanup in the sessions database
 - translate titles of "show all" and "unassigned" issue lists
   in classic template (sf patch 1424576)
 - "as" is a keyword in Python 2.6
--- a/roundup/__init__.py	Thu Oct 05 21:14:57 2006 +0000
+++ b/roundup/__init__.py	Thu Oct 05 23:08:21 2006 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: __init__.py,v 1.40 2006-10-04 03:52:36 richard Exp $
+# $Id: __init__.py,v 1.41 2006-10-05 23:08:20 richard Exp $
 
 '''Roundup - issue tracking for knowledge workers.
 
@@ -68,6 +68,6 @@
 '''
 __docformat__ = 'restructuredtext'
 
-__version__ = '1.2.0'
+__version__ = '1.2.1'
 
 # vim: set filetype=python ts=4 sw=4 et si
--- a/roundup/mailgw.py	Thu Oct 05 21:14:57 2006 +0000
+++ b/roundup/mailgw.py	Thu Oct 05 23:08:21 2006 +0000
@@ -72,7 +72,7 @@
 an exception, the original message is bounced back to the sender with the
 explanatory message given in the exception.
 
-$Id: mailgw.py,v 1.177 2006-08-11 01:41:25 richard Exp $
+$Id: mailgw.py,v 1.178 2006-10-05 23:08:20 richard Exp $
 """
 __docformat__ = 'restructuredtext'
 
@@ -612,18 +612,20 @@
         # Re: "[issue1234] title of issue [status=resolved]"
         open, close = config['MAILGW_SUBJECT_SUFFIX_DELIMITERS']
         delim_open = re.escape(open)
+        if delim_open in '[(': delim_open = '\\' + delim_open
         delim_close = re.escape(close)
-        subject_re = re.compile(r'''
+        if delim_close in '[(': delim_close = '\\' + delim_close
+        subject_re = r'''
         (?P<refwd>\s*\W?\s*(fw|fwd|re|aw)\W\s*)*\s*   # Re:
         (?P<quote>")?                                 # Leading "
-        (\[(?P<classname>[^\d\s]+)                    # [issue..
+        (%s(?P<classname>[^\d\s]+)                    # [issue..
            (?P<nodeid>\d+)?                           # ..1234]
-         \])?\s*
+         %s)?\s*
         (?P<title>[^%s]+)?                             # issue title
         "?                                            # Trailing "
         (?P<argswhole>%s(?P<args>.+?)%s)?             # [prop=value]
-        '''%(delim_open, delim_open, delim_close),
-        re.IGNORECASE|re.VERBOSE)
+        '''%(delim_open, delim_close, delim_open, delim_open, delim_close)
+        subject_re = re.compile(subject_re, re.IGNORECASE|re.VERBOSE)
 
         # figure subject line parsing modes
         pfxmode = config['MAILGW_SUBJECT_PREFIX_PARSING']
--- a/test/test_mailgw.py	Thu Oct 05 21:14:57 2006 +0000
+++ b/test/test_mailgw.py	Thu Oct 05 23:08:21 2006 +0000
@@ -8,7 +8,7 @@
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 #
-# $Id: test_mailgw.py,v 1.78 2006-08-18 01:31:38 richard Exp $
+# $Id: test_mailgw.py,v 1.79 2006-10-05 23:08:21 richard Exp $
 
 # TODO: test bcc
 
@@ -1253,6 +1253,21 @@
         self.assertEqual(self.db.issue.get(nodeid, 'title'), 'testing')
         self.assertEqual(self.db.issue.get(nodeid, 'assignedto'), self.mary_id)
 
+    def testPrefixDelimiters(self):
+        self.instance.config.MAILGW_SUBJECT_SUFFIX_DELIMITERS = '{}'
+        self.db.keyword.create(name='Foo')
+        self._handle_mail('''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}
+
+''')
+        assert not os.path.exists(SENDMAILDEBUG)
+        self.assertEqual(self.db.keyword.get('1', 'name'), 'Bar')
+
     def testCommandDelimitersIgnore(self):
         self.instance.config.MAILGW_SUBJECT_SUFFIX_DELIMITERS = '{}'
         nodeid = self._handle_mail('''Content-Type: text/plain;

Roundup Issue Tracker: http://roundup-tracker.org/