diff options
| author | Barry Warsaw | 2012-12-17 22:49:18 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2012-12-17 22:49:18 -0500 |
| commit | 875f4df48ece06fce8328e375ee1cae9c9408234 (patch) | |
| tree | 18a11e628dfcf13949eaf40695ea7801d1a51bd8 /src/mailman/model/requests.py | |
| parent | e47615a26cb31694439ce1ab27436c95bfc1f747 (diff) | |
| parent | 7d6069ad0411cecbb44e34838d53c48ba8598802 (diff) | |
| download | mailman-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/model/requests.py')
| -rw-r--r-- | src/mailman/model/requests.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mailman/model/requests.py b/src/mailman/model/requests.py index 5eb940233..58f2f2d4c 100644 --- a/src/mailman/model/requests.py +++ b/src/mailman/model/requests.py @@ -40,6 +40,8 @@ from mailman.interfaces.requests import IListRequests, RequestType @implementer(IPendable) class DataPendable(dict): + """See `IPendable`.""" + def update(self, mapping): # Keys and values must be strings (unicodes, but bytes values are # accepted for now). Any other types for keys are a programming @@ -58,6 +60,7 @@ class DataPendable(dict): @implementer(IListRequests) class ListRequests: + """See `IListRequests`.""" def __init__(self, mailing_list): self.mailing_list = mailing_list @@ -111,7 +114,7 @@ class ListRequests: if request_type is not None and result.request_type != request_type: return None if result.data_hash is None: - return result.key, result.data_hash + return result.key, None pendable = getUtility(IPendings).confirm( result.data_hash, expunge=False) data = dict() @@ -121,6 +124,8 @@ class ListRequests: data[key[5:]] = loads(value.encode('raw-unicode-escape')) else: data[key] = value + # Some APIs need the request type. + data['_request_type'] = result.request_type.name return result.key, data @dbconnection |
