diff options
| author | Barry Warsaw | 2016-11-25 11:54:10 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2016-11-25 11:54:10 -0500 |
| commit | 17ec368191f4e2c80fbead954511bb5a251dfe45 (patch) | |
| tree | aa802d1960ac3a096e192e572cd238411dc57ec9 /src | |
| parent | 1f4919ab99bc6ca15553e2e4f569313b91b4a752 (diff) | |
| download | mailman-17ec368191f4e2c80fbead954511bb5a251dfe45.tar.gz mailman-17ec368191f4e2c80fbead954511bb5a251dfe45.tar.zst mailman-17ec368191f4e2c80fbead954511bb5a251dfe45.zip | |
Add NEWS and a little bit of cleanup.
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/docs/NEWS.rst | 2 | ||||
| -rw-r--r-- | src/mailman/rest/post_moderation.py | 5 | ||||
| -rw-r--r-- | src/mailman/rest/tests/test_moderation.py | 10 |
3 files changed, 10 insertions, 7 deletions
diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst index db65e9c69..27f3ea5eb 100644 --- a/src/mailman/docs/NEWS.rst +++ b/src/mailman/docs/NEWS.rst @@ -101,6 +101,8 @@ Bugs addresses. Given by Tom Briles. (Closes: #68) * Transmit the moderation reason and expose it in the REST API as the ``reason`` attribute. Given by Aurélien Bompard. + * Don't return a 500 error from the REST API when trying to handle a held + message with defective content. Given by Abhilash Raj. (Closes: #256) Configuration ------------- diff --git a/src/mailman/rest/post_moderation.py b/src/mailman/rest/post_moderation.py index ee31e8694..33a32de20 100644 --- a/src/mailman/rest/post_moderation.py +++ b/src/mailman/rest/post_moderation.py @@ -76,8 +76,9 @@ class _HeldMessageBase(_ModerationBase): except KeyError: # If the message can't be parsed, return a generic message instead # of raising an error. - # See http://bugs.python.org/issue27321 and #256 - resource['msg'] = 'this message is defective' + # + # See http://bugs.python.org/issue27321 and GL#256 + resource['msg'] = 'This message is defective' # Some of the _mod_* keys we want to rename and place into the JSON # resource. Others we can drop. Since we're mutating the dictionary, # we need to make a copy of the keys. When you port this to Python 3, diff --git a/src/mailman/rest/tests/test_moderation.py b/src/mailman/rest/tests/test_moderation.py index 628b79e52..7ac23da21 100644 --- a/src/mailman/rest/tests/test_moderation.py +++ b/src/mailman/rest/tests/test_moderation.py @@ -211,10 +211,10 @@ class TestSubscriptionModeration(unittest.TestCase): def test_view_malformed_held_message(self): # Opening a bad (i.e. bad structure) email and holding it. - email_path = resource_filename('mailman.rest.tests.data', - 'bad_email.eml') - with open(email_path, 'rb') as f: - msg = message_from_binary_file(f) + email_path = resource_filename( + 'mailman.rest.tests.data', 'bad_email.eml') + with open(email_path, 'rb') as fp: + msg = message_from_binary_file(fp) msg.sender = 'aperson@example.com' with transaction(): hold_message(self._mlist, msg) @@ -225,7 +225,7 @@ class TestSubscriptionModeration(unittest.TestCase): self.assertEqual(response.status, 200) self.assertEqual(len(content['entries']), 1) self.assertEqual(content['entries'][0]['msg'], - 'this message is defective') + 'This message is defective') def test_individual_request(self): # We can view an individual request. |
