Skip to content

Commit 1643dc9

Browse files
author
Richard Jones
committed
E-mail subject line prefix delimiter configuration was being ignored
1 parent b6fffc6 commit 1643dc9

File tree

4 files changed

+32
-10
lines changed

4 files changed

+32
-10
lines changed

CHANGES.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
This file contains the changes to the Roundup system over time. The entries
22
are given with the most recent entry first.
33

4+
2006-??-?? 1.2.1
5+
Fixed:
6+
- E-mail subject line prefix delimiter configuration was being ignored.
7+
8+
49
2006-10-04 1.2.0
510
Feature:
611
- supports Python 2.5, including the sqlite3 module
@@ -52,7 +57,7 @@ Fixed:
5257
- Bug with name-collisions in sorted classes when sorting by Link
5358
properties in metakit backend fixed
5459
- Postgres backend allows transaction collisions to be ignored when
55-
committing clenup in the sessions database
60+
committing cleanup in the sessions database
5661
- translate titles of "show all" and "unassigned" issue lists
5762
in classic template (sf patch 1424576)
5863
- "as" is a keyword in Python 2.6

roundup/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: __init__.py,v 1.40 2006-10-04 03:52:36 richard Exp $
18+
# $Id: __init__.py,v 1.41 2006-10-05 23:08:20 richard Exp $
1919

2020
'''Roundup - issue tracking for knowledge workers.
2121
@@ -68,6 +68,6 @@
6868
'''
6969
__docformat__ = 'restructuredtext'
7070

71-
__version__ = '1.2.0'
71+
__version__ = '1.2.1'
7272

7373
# vim: set filetype=python ts=4 sw=4 et si

roundup/mailgw.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class node. Any parts of other types are each stored in separate files
7272
an exception, the original message is bounced back to the sender with the
7373
explanatory message given in the exception.
7474
75-
$Id: mailgw.py,v 1.177 2006-08-11 01:41:25 richard Exp $
75+
$Id: mailgw.py,v 1.178 2006-10-05 23:08:20 richard Exp $
7676
"""
7777
__docformat__ = 'restructuredtext'
7878

@@ -612,18 +612,20 @@ def handle_message(self, message):
612612
# Re: "[issue1234] title of issue [status=resolved]"
613613
open, close = config['MAILGW_SUBJECT_SUFFIX_DELIMITERS']
614614
delim_open = re.escape(open)
615+
if delim_open in '[(': delim_open = '\\' + delim_open
615616
delim_close = re.escape(close)
616-
subject_re = re.compile(r'''
617+
if delim_close in '[(': delim_close = '\\' + delim_close
618+
subject_re = r'''
617619
(?P<refwd>\s*\W?\s*(fw|fwd|re|aw)\W\s*)*\s* # Re:
618620
(?P<quote>")? # Leading "
619-
(\[(?P<classname>[^\d\s]+) # [issue..
621+
(%s(?P<classname>[^\d\s]+) # [issue..
620622
(?P<nodeid>\d+)? # ..1234]
621-
\])?\s*
623+
%s)?\s*
622624
(?P<title>[^%s]+)? # issue title
623625
"? # Trailing "
624626
(?P<argswhole>%s(?P<args>.+?)%s)? # [prop=value]
625-
'''%(delim_open, delim_open, delim_close),
626-
re.IGNORECASE|re.VERBOSE)
627+
'''%(delim_open, delim_close, delim_open, delim_open, delim_close)
628+
subject_re = re.compile(subject_re, re.IGNORECASE|re.VERBOSE)
627629

628630
# figure subject line parsing modes
629631
pfxmode = config['MAILGW_SUBJECT_PREFIX_PARSING']

test/test_mailgw.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# but WITHOUT ANY WARRANTY; without even the implied warranty of
99
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1010
#
11-
# $Id: test_mailgw.py,v 1.78 2006-08-18 01:31:38 richard Exp $
11+
# $Id: test_mailgw.py,v 1.79 2006-10-05 23:08:21 richard Exp $
1212

1313
# TODO: test bcc
1414

@@ -1253,6 +1253,21 @@ def testCommandDelimiters(self):
12531253
self.assertEqual(self.db.issue.get(nodeid, 'title'), 'testing')
12541254
self.assertEqual(self.db.issue.get(nodeid, 'assignedto'), self.mary_id)
12551255

1256+
def testPrefixDelimiters(self):
1257+
self.instance.config.MAILGW_SUBJECT_SUFFIX_DELIMITERS = '{}'
1258+
self.db.keyword.create(name='Foo')
1259+
self._handle_mail('''Content-Type: text/plain;
1260+
charset="iso-8859-1"
1261+
From: richard <richard@test>
1262+
1263+
Message-Id: <followup_dummy_id>
1264+
In-Reply-To: <dummy_test_message_id>
1265+
Subject: {keyword1} Testing... {name=Bar}
1266+
1267+
''')
1268+
assert not os.path.exists(SENDMAILDEBUG)
1269+
self.assertEqual(self.db.keyword.get('1', 'name'), 'Bar')
1270+
12561271
def testCommandDelimitersIgnore(self):
12571272
self.instance.config.MAILGW_SUBJECT_SUFFIX_DELIMITERS = '{}'
12581273
nodeid = self._handle_mail('''Content-Type: text/plain;

0 commit comments

Comments
 (0)