summaryrefslogtreecommitdiff
path: root/src/mailman/interfaces/pipeline.py
diff options
context:
space:
mode:
authorBarry Warsaw2017-08-04 01:13:04 +0000
committerBarry Warsaw2017-08-04 01:13:04 +0000
commit324226f1f859f6be5e932dc9abe638aba268d154 (patch)
treef021166b8c82bb02feff82a9360ba61a44b804ee /src/mailman/interfaces/pipeline.py
parente6326533b78290514ede917ed1cb95804759a45a (diff)
parent9cdcffbc1189a19bc2963cf3d5c86a3d4f1f24a6 (diff)
downloadmailman-324226f1f859f6be5e932dc9abe638aba268d154.tar.gz
mailman-324226f1f859f6be5e932dc9abe638aba268d154.tar.zst
mailman-324226f1f859f6be5e932dc9abe638aba268d154.zip
Diffstat (limited to 'src/mailman/interfaces/pipeline.py')
-rw-r--r--src/mailman/interfaces/pipeline.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mailman/interfaces/pipeline.py b/src/mailman/interfaces/pipeline.py
index fac89c442..faccc52d2 100644
--- a/src/mailman/interfaces/pipeline.py
+++ b/src/mailman/interfaces/pipeline.py
@@ -17,13 +17,12 @@
"""Interface for describing pipelines."""
+from mailman.core.i18n import _, format_reasons
from public import public
from zope.interface import Attribute, Interface
-# For i18n extraction.
-def _(s):
- return s
+NL = '\n'
# These are thrown but they aren't exceptions so don't inherit from
@@ -44,11 +43,20 @@ class DiscardMessage(BaseException):
class RejectMessage(BaseException):
"""The message will be bounced back to the sender"""
- def __init__(self, message=None):
+ def __init__(self, message=None, reasons=None, substitutions=None):
self.message = message
+ self.reasons = reasons
+ self.substitutions = ({} if substitutions is None else substitutions)
def __str__(self):
- return self.message
+ if self.message is None:
+ return _('[No details are available]')
+ reasons = (_('[No reasons given]')
+ if self.reasons is None
+ else NL.join(format_reasons(self.reasons)))
+ substitutions = self.substitutions.copy()
+ substitutions['reasons'] = reasons
+ return _(self.message, substitutions)
@public