diff options
| author | Barry Warsaw | 2011-04-27 20:11:10 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2011-04-27 20:11:10 -0400 |
| commit | 7181a4d6638605595b043f66eb3cd01dd93a0ff2 (patch) | |
| tree | b7121437005d59e5f07e01d4857b248e6c5ab16d /src/mailman/interfaces | |
| parent | 50823ea9d544114603b3f5d814914908b27749d6 (diff) | |
| download | mailman-7181a4d6638605595b043f66eb3cd01dd93a0ff2.tar.gz mailman-7181a4d6638605595b043f66eb3cd01dd93a0ff2.tar.zst mailman-7181a4d6638605595b043f66eb3cd01dd93a0ff2.zip | |
Checkpointing for refactoring.
Diffstat (limited to 'src/mailman/interfaces')
| -rw-r--r-- | src/mailman/interfaces/bounce.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/mailman/interfaces/bounce.py b/src/mailman/interfaces/bounce.py index fba269609..60c162bb2 100644 --- a/src/mailman/interfaces/bounce.py +++ b/src/mailman/interfaces/bounce.py @@ -21,18 +21,28 @@ from __future__ import absolute_import, unicode_literals __metaclass__ = type __all__ = [ + 'BounceStatus', 'IBounceDetector', - 'NonFatal', ] +from flufl.enum import Enum from zope.interface import Interface -# Matching addresses were found, but they were determined to be non-fatal. In -# this case, processing is halted but no bounces are registered. -NonFatal = object() +class BounceStatus(Enum): + """Special bounce statuses.""" + + # Matching addresses were found, but they were determined to be non-fatal. + # In this case, processing is halted but no bounces are registered. + non_fatal = 1 + + # If a bounce detector returns Stop, that means to just discard the + # message. An example is warning messages for temporary delivery + # problems. These shouldn't trigger a bounce notification, but we also + # don't want to send them on to the list administrator. + stop = 2 @@ -45,8 +55,9 @@ class IBounceDetector(Interface): :param msg: An email message. :type msg: `Message` :return: The detected bouncing addresses. When bouncing addresses are - found but are determined to be non-fatal, the special marker - `NonFatal` can be returned to halt any bounce processing - pipeline. None can be returned if no addresses are found. - :rtype: A sequence of strings, None, or NonFatal. + found but are determined to be non-fatal, the enum + `BounceStatus.non_fatal` can be returned to halt any bounce + processing pipeline. When bounce processing should stop, a + `BounceStatus.stop` is returned. + :rtype: A set strings, or a `BounceStatus` """ |
