@@ -72,7 +72,7 @@ class node. Any parts of other types are each stored in separate files
7272an exception, the original message is bounced back to the sender with the
7373explanatory 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
113113class 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 ('\n Mail Gateway Help\n =================' )
136+ m .append ('\n \ n Mail 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):
197197Valid class names are: %s
198198Subject 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 , '''
291305Roundup 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 , '''
310324Roundup 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 , '''
316330Roundup 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