summaryrefslogtreecommitdiff
path: root/src/mailman/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/core')
-rw-r--r--src/mailman/core/errors.py28
-rw-r--r--src/mailman/core/logging.py4
-rw-r--r--src/mailman/core/tests/test_runner.py2
3 files changed, 31 insertions, 3 deletions
diff --git a/src/mailman/core/errors.py b/src/mailman/core/errors.py
index 529ac86fe..42b536d46 100644
--- a/src/mailman/core/errors.py
+++ b/src/mailman/core/errors.py
@@ -43,7 +43,10 @@ __all__ = [
'MemberError',
'MustDigestError',
'PasswordError',
+ 'RESTError',
+ 'ReadOnlyPATCHRequestError',
'RejectMessage',
+ 'UnknownPATCHRequestError',
]
@@ -87,6 +90,12 @@ def _(s):
class HandlerError(MailmanError):
"""Base class for all handler errors."""
+ def __init__(self, message=None):
+ self.message = message
+
+ def __str__(self):
+ return self.message
+
class HoldMessage(HandlerError):
"""Base class for all message-being-held short circuits."""
@@ -126,3 +135,22 @@ class BadPasswordSchemeError(PasswordError):
def __str__(self):
return 'A bad password scheme was given: %s' % self.scheme_name
+
+
+
+class RESTError(MailmanError):
+ """Base class for REST API errors."""
+
+
+class UnknownPATCHRequestError(RESTError):
+ """A PATCH request contained an unknown attribute."""
+
+ def __init__(self, attribute):
+ self.attribute = attribute
+
+
+class ReadOnlyPATCHRequestError(RESTError):
+ """A PATCH request contained a read-only attribute."""
+
+ def __init__(self, attribute):
+ self.attribute = attribute
diff --git a/src/mailman/core/logging.py b/src/mailman/core/logging.py
index af04b58d1..2442d4913 100644
--- a/src/mailman/core/logging.py
+++ b/src/mailman/core/logging.py
@@ -40,8 +40,8 @@ _handlers = {}
-# XXX I would love to simplify things and use Python 2.6's WatchedFileHandler,
-# but there are two problems. First, it's more difficult to handle the test
+# XXX I would love to simplify things and use Python's WatchedFileHandler, but
+# there are two problems. First, it's more difficult to handle the test
# suite's need to reopen the file handler to a different path. Does
# zope.testing's logger support fix this?
#
diff --git a/src/mailman/core/tests/test_runner.py b/src/mailman/core/tests/test_runner.py
index ad2548adc..80a503f5d 100644
--- a/src/mailman/core/tests/test_runner.py
+++ b/src/mailman/core/tests/test_runner.py
@@ -81,7 +81,7 @@ Message-ID: <ant>
self.assertEqual(event.message['message-id'], '<ant>')
self.assertEqual(event.metadata['listname'], 'test@example.com')
self.assertTrue(isinstance(event.error, RuntimeError))
- self.assertEqual(event.error.message, 'borked')
+ self.assertEqual(str(event.error), 'borked')
self.assertTrue(isinstance(event.runner, CrashingRunner))
# The message should also have ended up in the shunt queue.
shunted = get_queue_messages('shunt')