diff options
| author | Barry Warsaw | 2016-04-29 00:28:05 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2016-04-29 00:28:05 -0400 |
| commit | 78d1f5918d2ec0b2351edb3ed005d5b8f7e4319c (patch) | |
| tree | 05ca840c89d0950d95b36566bed5723bd9409764 /src/mailman/rest/lists.py | |
| parent | 17103aae14f53655fd7685a0867724f6420b9282 (diff) | |
| download | mailman-78d1f5918d2ec0b2351edb3ed005d5b8f7e4319c.tar.gz mailman-78d1f5918d2ec0b2351edb3ed005d5b8f7e4319c.tar.zst mailman-78d1f5918d2ec0b2351edb3ed005d5b8f7e4319c.zip | |
Diffstat (limited to 'src/mailman/rest/lists.py')
| -rw-r--r-- | src/mailman/rest/lists.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/mailman/rest/lists.py b/src/mailman/rest/lists.py index 4f0c56569..69d14e548 100644 --- a/src/mailman/rest/lists.py +++ b/src/mailman/rest/lists.py @@ -251,23 +251,19 @@ class MembersOfList(MemberCollection): def on_delete(self, request, response): """Delete the members of the named mailing list.""" status = {} - success = [] - fail = [] try: validator = Validator(emails=list_of_strings_validator) arguments = validator(request) - emails = arguments.pop('emails') - except ValueError: - return bad_request(response, b'Invalid Input.') + except ValueError as error: + bad_request(response, str(error)) + return + emails = arguments.pop('emails') success, fail = getUtility(ISubscriptionService).unsubscribe_members( self._mlist.list_id, emails) - if len(fail) == 0: - return no_content(response) - for email in fail: - if email in success: - status[email] = 'Member already deleted.' - else: - status[email] = 'No such member.' + # There should be no email in both sets. + assert success.isdisjoint(fail), (success, fail) + status.update({email: True for email in success}) + status.update({email: False for email in fail}) okay(response, etag(status)) |
