diff options
author | Mark Sapiro <mark@msapiro.net> | 2017-02-14 19:15:58 -0800 |
---|---|---|
committer | Mark Sapiro <mark@msapiro.net> | 2017-02-14 19:15:58 -0800 |
commit | a852463283f44357fec29e0bce49f3cc83ed9c2f (patch) | |
tree | 3b881fc1e890ae5d9f05770408ef1e28378bfe19 /Mailman | |
parent | 78fb8983ae8873ba1ff0640e556eb61b88dba9a7 (diff) | |
download | mailman2-a852463283f44357fec29e0bce49f3cc83ed9c2f.tar.gz mailman2-a852463283f44357fec29e0bce49f3cc83ed9c2f.tar.xz mailman2-a852463283f44357fec29e0bce49f3cc83ed9c2f.zip |
Catch NotAMemberError when member is removed before probe bounce returns.
Diffstat (limited to 'Mailman')
-rw-r--r-- | Mailman/Queue/BounceRunner.py | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/Mailman/Queue/BounceRunner.py b/Mailman/Queue/BounceRunner.py index 651039d6..2d14f284 100644 --- a/Mailman/Queue/BounceRunner.py +++ b/Mailman/Queue/BounceRunner.py @@ -29,6 +29,7 @@ from email.Utils import parseaddr from Mailman import mm_cfg from Mailman import Utils from Mailman import LockFile +from Mailman.Errors import NotAMemberError from Mailman.Message import UserNotification from Mailman.Bouncer import _BounceInfo from Mailman.Bouncers import BouncerAPI @@ -151,19 +152,26 @@ class BounceMixin: mlist.Lock() try: op, addr, bmsg = mlist.pend_confirm(token) - info = mlist.getBounceInfo(addr) - if not info: - # info was deleted before probe bounce was received. - # Just create a new info. - info = _BounceInfo(addr, - 0.0, - time.localtime()[:3], - mlist.bounce_you_are_disabled_warnings - ) - mlist.disableBouncingMember(addr, info, bmsg) - # Only save the list if we're unlocking it - if not locked: - mlist.Save() + # For Python 2.4 compatibility we need an inner try because + # try: ... except: ... finally: requires Python 2.5+ + try: + info = mlist.getBounceInfo(addr) + if not info: + # info was deleted before probe bounce was received. + # Just create a new info. + info = _BounceInfo(addr, + 0.0, + time.localtime()[:3], + mlist.bounce_you_are_disabled_warnings + ) + mlist.disableBouncingMember(addr, info, bmsg) + # Only save the list if we're unlocking it + if not locked: + mlist.Save() + except NotAMemberError: + # Member was removed before probe bounce returned. + # Just ignore it. + pass finally: if not locked: mlist.Unlock() |