diff options
author | bwarsaw <> | 2003-09-22 02:40:05 +0000 |
---|---|---|
committer | bwarsaw <> | 2003-09-22 02:40:05 +0000 |
commit | b957dbc4b1100321697f94a78b4efd72a0f72f8c (patch) | |
tree | 5945bd07a3b66b21d4181991aaaf8a30cbf48c9a /Mailman | |
parent | 083ffbb8af5bff342ac30ceed719cd7d985cce00 (diff) | |
download | mailman2-b957dbc4b1100321697f94a78b4efd72a0f72f8c.tar.gz mailman2-b957dbc4b1100321697f94a78b4efd72a0f72f8c.tar.xz mailman2-b957dbc4b1100321697f94a78b4efd72a0f72f8c.zip |
Backporting from the HEAD -- updated bouncers
Diffstat (limited to '')
-rw-r--r-- | Mailman/Bouncers/DSN.py | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Mailman/Bouncers/DSN.py b/Mailman/Bouncers/DSN.py index 6c32f0ff..666281c6 100644 --- a/Mailman/Bouncers/DSN.py +++ b/Mailman/Bouncers/DSN.py @@ -24,6 +24,14 @@ from email.Iterators import typed_subpart_iterator from email.Utils import parseaddr from cStringIO import StringIO +from Mailman.Bouncers.BouncerAPI import Stop + +try: + True, False +except NameError: + True = 1 + False = 0 + def check(msg): @@ -43,21 +51,18 @@ def check(msg): # that for other purposes :( # # Also grok out Action so we can do something with that too. - action = msgblock.get('action', '') - # BAW: Should we treat delayed bounces the same? Yes, because if - # the transient problem clears up, they should get unbounced. The - # other problem is what to do about a DSN that has both delayed - # and failed actions in multiple header blocks? We're not - # architected to handle that. ;/ - if action.lower() not in ('failed', 'failure', 'delayed'): + action = msgblock.get('action', '').lower() + if action == 'delayed': + return Stop + if action not in ('failed', 'failure'): # Some non-permanent failure, so ignore this block continue params = [] - foundp = 0 + foundp = False for header in ('original-recipient', 'final-recipient'): for k, v in msgblock.get_params([], header): if k.lower() == 'rfc822': - foundp = 1 + foundp = True else: params.append(k) if foundp: @@ -69,7 +74,7 @@ def check(msg): for a in addrs: if a is not None: realname, a = parseaddr(a) - rtnaddrs[a] = 1 + rtnaddrs[a] = True return rtnaddrs.keys() |