Skip to content

Commit 4bb2cfb

Browse files
author
Richard Jones
committed
Initial cut at trying to handle people responding to CC'ed messages...
...that create an issue.
1 parent a67990b commit 4bb2cfb

File tree

2 files changed

+35
-10
lines changed

2 files changed

+35
-10
lines changed

doc/announcement.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ pre-release 1. Users who downloaded that release MUST download this release.
1515
Source and documentation is available at the website:
1616
http://roundup.sourceforge.net/
1717

18+
Release Info (via download page):
19+
https://sourceforge.net/project/showfiles.php?group_id=31577
20+
21+
Mailing lists - the place to ask questions:
22+
https://sourceforge.net/mail/?group_id=31577
23+
24+
1825

1926
About Roundup
2027
=============

roundup/mailgw.py

Lines changed: 28 additions & 10 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.17 2001-10-09 07:25:59 richard Exp $
75+
$Id: mailgw.py,v 1.18 2001-10-11 06:38:57 richard Exp $
7676
'''
7777

7878

@@ -106,9 +106,9 @@ def getPart(self):
106106
s.seek(0)
107107
return Message(s)
108108

109-
subject_re = re.compile(r'(\[?(fwd|re):\s*)*'
110-
r'(\[(?P<classname>[^\d]+)(?P<nodeid>\d+)?\])'
111-
r'(?P<title>[^\[]+)(\[(?P<args>.+?)\])?', re.I)
109+
subject_re = re.compile(r'(?P<refwd>\s*\W?\s*(fwd|re)\s*\W?\s*)*'
110+
r'\s*(\[(?P<classname>[^\d]+)(?P<nodeid>\d+)?\])'
111+
r'\s*(?P<title>[^\[]+)(\[(?P<args>.+?)\])?', re.I)
112112

113113
class MailGW:
114114
def __init__(self, db):
@@ -133,7 +133,7 @@ def main(self, fp):
133133
sendto = [message.getaddrlist('from')[0][1]]
134134
m = ['Subject: Failed issue tracker submission', '']
135135
m.append(str(value))
136-
m.append('\nMail Gateway Help\n=================')
136+
m.append('\n\nMail Gateway Help\n=================')
137137
m.append(fulldoc)
138138
except:
139139
# bounce the message back to the sender with the error message
@@ -197,12 +197,26 @@ def handle_message(self, message):
197197
Valid class names are: %s
198198
Subject was: "%s"
199199
'''%(classname, ', '.join(self.db.getclasses()), subject)
200+
201+
# If there's no nodeid, check to see if this is a followup and
202+
# maybe someone's responded to the initial mail that created an
203+
# entry. Try to find the matching nodes with the same title, and
204+
# use the _last_ one matched (since that'll _usually_ be the most
205+
# recent...)
206+
if not nodeid and m.group('refwd'):
207+
l = cl.stringFind(title=title)
208+
if l:
209+
nodeid = l[-1]
210+
211+
# start of the props
200212
properties = cl.getprops()
201213
props = {}
214+
215+
# handle the args
202216
args = m.group('args')
203217
if args:
204-
for prop in string.split(m.group('args'), ';'):
205-
try:
218+
for prop in string.split(args, ';'):
219+
Try:
206220
key, value = prop.split('=')
207221
except ValueError, message:
208222
raise MailUsageError, '''
@@ -289,7 +303,7 @@ def handle_message(self, message):
289303
if content is None:
290304
raise MailUsageError, '''
291305
Roundup requires the submission to be plain text. The message parser could
292-
not find a text/plain part o use.
306+
not find a text/plain part to use.
293307
'''
294308

295309
elif content_type[:10] == 'multipart/':
@@ -308,13 +322,13 @@ def handle_message(self, message):
308322
if content is None:
309323
raise MailUsageError, '''
310324
Roundup requires the submission to be plain text. The message parser could
311-
not find a text/plain part o use.
325+
not find a text/plain part to use.
312326
'''
313327

314328
elif content_type != 'text/plain':
315329
raise MailUsageError, '''
316330
Roundup requires the submission to be plain text. The message parser could
317-
not find a text/plain part o use.
331+
not find a text/plain part to use.
318332
'''
319333

320334
else:
@@ -402,6 +416,10 @@ def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'),
402416

403417
#
404418
# $Log: not supported by cvs2svn $
419+
# Revision 1.17 2001/10/09 07:25:59 richard
420+
# Added the Password property type. See "pydoc roundup.password" for
421+
# implementation details. Have updated some of the documentation too.
422+
#
405423
# Revision 1.16 2001/10/05 02:23:24 richard
406424
# . roundup-admin create now prompts for property info if none is supplied
407425
# on the command-line.

0 commit comments

Comments
 (0)