diff options
| author | Barry Warsaw | 2017-08-04 01:13:04 +0000 |
|---|---|---|
| committer | Barry Warsaw | 2017-08-04 01:13:04 +0000 |
| commit | 9cdcffbc1189a19bc2963cf3d5c86a3d4f1f24a6 (patch) | |
| tree | f021166b8c82bb02feff82a9360ba61a44b804ee /src/mailman/interfaces/pipeline.py | |
| parent | e6326533b78290514ede917ed1cb95804759a45a (diff) | |
| download | mailman-9cdcffbc1189a19bc2963cf3d5c86a3d4f1f24a6.tar.gz mailman-9cdcffbc1189a19bc2963cf3d5c86a3d4f1f24a6.tar.zst mailman-9cdcffbc1189a19bc2963cf3d5c86a3d4f1f24a6.zip | |
Diffstat (limited to 'src/mailman/interfaces/pipeline.py')
| -rw-r--r-- | src/mailman/interfaces/pipeline.py | 18 |
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 |
