Update of /cvsroot/mailman/mailman/Mailman/Bouncers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18098/Bouncers
Modified Files:
Tag: Release_2_1-maint
BouncerAPI.py DSN.py Qmail.py
Log Message:
Changed BouncerAPI.py to return Stop from a Bouncer and changed
BounceRunner.py to discard the bounce when Stop returned. Changed
DSN.py to recognize Action: headers with comments. Changed Qmail.py
to recognize an observed different starting string.
Index: BouncerAPI.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Bouncers/BouncerAPI.py,v
retrieving revision 2.14.2.1
retrieving revision 2.14.2.2
diff -u -d -r2.14.2.1 -r2.14.2.2
--- BouncerAPI.py 27 Aug 2005 01:40:15 -0000 2.14.2.1
+++ BouncerAPI.py 1 Mar 2006 02:34:10 -0000 2.14.2.2
@@ -1,4 +1,4 @@
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2006 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -12,7 +12,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
"""Contains all the common functionality for msg bounce scanning API.
@@ -62,10 +63,7 @@
modname = 'Mailman.Bouncers.' + module
__import__(modname)
addrs = sys.modules[modname].process(msg)
- if addrs is Stop:
- # One of the detectors recognized the bounce, but there were no
- # addresses to extract. Return the empty list.
- return []
- elif addrs:
+ if addrs:
+ # Return addrs even if it is Stop. BounceRunner needs this info.
return addrs
return []
Index: DSN.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Bouncers/DSN.py,v
retrieving revision 2.7.2.3
retrieving revision 2.7.2.4
diff -u -d -r2.7.2.3 -r2.7.2.4
--- DSN.py 27 Aug 2005 01:40:15 -0000 2.7.2.3
+++ DSN.py 1 Mar 2006 02:34:10 -0000 2.7.2.4
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2006 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -12,7 +12,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
"""Parse RFC 3464 (i.e. DSN) bounce formats.
@@ -52,9 +53,10 @@
#
# Also grok out Action so we can do something with that too.
action = msgblock.get('action', '').lower()
- if action == 'delayed':
+ # Some MTAs have been observed that put comments on the action.
+ if action.startswith('delayed'):
return Stop
- if action not in ('failed', 'failure'):
+ if not action.startswith('fail'):
# Some non-permanent failure, so ignore this block
continue
params = []
Index: Qmail.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Bouncers/Qmail.py,v
retrieving revision 2.4.2.1
retrieving revision 2.4.2.2
diff -u -d -r2.4.2.1 -r2.4.2.2
--- Qmail.py 27 Aug 2005 01:40:15 -0000 2.4.2.1
+++ Qmail.py 1 Mar 2006 02:34:10 -0000 2.4.2.2
@@ -1,4 +1,4 @@
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2006 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -12,7 +12,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
"""Parse bounce messages generated by qmail.
@@ -28,7 +29,11 @@
import re
import email.Iterators
-introtag = 'Hi. This is the'
+# Other (non-standard?) intros have been observed in the wild.
+introtags = [
+ 'Hi. This is the',
+ "We're sorry. There's a problem"
+ ]
acre = re.compile(r'<(?P<addr>[^>]*)>:')
@@ -42,8 +47,11 @@
state = 0
for line in email.Iterators.body_line_iterator(msg):
line = line.strip()
- if state == 0 and line.startswith(introtag):
- state = 1
+ if state == 0:
+ for introtag in introtags:
+ if line.startswith(introtag):
+ state = 1
+ break
elif state == 1 and not line:
# Looking for the end of the intro paragraph
state = 2
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org