summaryrefslogtreecommitdiff
path: root/src/mailman/rest/lists.py
diff options
context:
space:
mode:
authorBarry Warsaw2012-12-17 22:49:18 -0500
committerBarry Warsaw2012-12-17 22:49:18 -0500
commit875f4df48ece06fce8328e375ee1cae9c9408234 (patch)
tree18a11e628dfcf13949eaf40695ea7801d1a51bd8 /src/mailman/rest/lists.py
parente47615a26cb31694439ce1ab27436c95bfc1f747 (diff)
parent7d6069ad0411cecbb44e34838d53c48ba8598802 (diff)
downloadmailman-875f4df48ece06fce8328e375ee1cae9c9408234.tar.gz
mailman-875f4df48ece06fce8328e375ee1cae9c9408234.tar.zst
mailman-875f4df48ece06fce8328e375ee1cae9c9408234.zip
* Expose a REST API for membership change (subscriptions and unsubscriptions)
moderation. (LP: #1090753) * Fixed `send_goodbye_message()`. (LP: #1091321) Also: * Rewrite and refactor request.rst into better documentation, moving non-good-path tests into unittests. This doctest now only describes the IRequests API, while the bulk of the moderation documentation now lives in moderator.rst. * When a subscription request is pended, the `delivery_mode` key is now just the enum item's name, instead of the str() of the enum (which would include the class name). We know it's always going to be a DeliveryMode enum. * Refactor out the welcome_message calculation from the welcome_message_uri, since the same algorithm can apply to goodbye_message_uri. * When a _Request is retrieved, include the RequestType enum name in the data dictionary (if there is one) under the `_request_type` key. Some APIs find this useful, but it's not directly returned otherwise. * For held messages via the REST API, flatten the `data` key into the top-level JSON representation, exposing some of the _mod_* keys under their non-_mod_* equivalent. Ignore _mod_* keys we don't care about. This is an API change.
Diffstat (limited to 'src/mailman/rest/lists.py')
-rw-r--r--src/mailman/rest/lists.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mailman/rest/lists.py b/src/mailman/rest/lists.py
index 4e9de6905..4a4b243b3 100644
--- a/src/mailman/rest/lists.py
+++ b/src/mailman/rest/lists.py
@@ -42,7 +42,7 @@ from mailman.rest.configuration import ListConfiguration
from mailman.rest.helpers import (
CollectionMixin, etag, no_content, path_to, restish_matcher)
from mailman.rest.members import AMember, MemberCollection
-from mailman.rest.moderation import HeldMessages
+from mailman.rest.moderation import HeldMessages, SubscriptionRequests
from mailman.rest.validator import Validator
@@ -176,11 +176,18 @@ class AList(_ListBase):
@resource.child()
def held(self, request, segments):
- """Return a list of held messages for the mailign list."""
+ """Return a list of held messages for the mailing list."""
if self._mlist is None:
return http.not_found()
return HeldMessages(self._mlist)
+ @resource.child()
+ def requests(self, request, segments):
+ """Return a list of subscription/unsubscription requests."""
+ if self._mlist is None:
+ return http.not_found()
+ return SubscriptionRequests(self._mlist)
+
class AllLists(_ListBase):