diff options
| author | Barry Warsaw | 2016-04-02 23:54:57 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2016-04-02 23:54:57 -0400 |
| commit | bbf49fb32d55efae759cd1c86287d80358346782 (patch) | |
| tree | 2a03795c9e5a901065b37f0a4bab5283e1b60676 /src | |
| parent | 8b2457f93da45778edc371d46eed40f7c8ecda7e (diff) | |
| download | mailman-bbf49fb32d55efae759cd1c86287d80358346782.tar.gz mailman-bbf49fb32d55efae759cd1c86287d80358346782.tar.zst mailman-bbf49fb32d55efae759cd1c86287d80358346782.zip | |
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman/rest/docs/addresses.rst | 9 | ||||
| -rw-r--r-- | src/mailman/rest/docs/domains.rst | 4 | ||||
| -rw-r--r-- | src/mailman/rest/docs/lists.rst | 4 | ||||
| -rw-r--r-- | src/mailman/rest/docs/membership.rst | 4 | ||||
| -rw-r--r-- | src/mailman/rest/docs/queues.rst | 2 | ||||
| -rw-r--r-- | src/mailman/rest/docs/users.rst | 5 | ||||
| -rw-r--r-- | src/mailman/rest/lists.py | 4 | ||||
| -rw-r--r-- | src/mailman/rest/users.py | 4 | ||||
| -rw-r--r-- | src/mailman/rest/wsgiapp.py | 1 |
9 files changed, 32 insertions, 5 deletions
diff --git a/src/mailman/rest/docs/addresses.rst b/src/mailman/rest/docs/addresses.rst index e5dff0f7c..6fb863cc6 100644 --- a/src/mailman/rest/docs/addresses.rst +++ b/src/mailman/rest/docs/addresses.rst @@ -146,6 +146,7 @@ sub-resource of the address. If the user does not exist, it will be created. >>> dump_json('http://localhost:9001/3.0/addresses/cris@example.com/user', ... {'display_name': 'Cris X. Person'}) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/users/1 server: ... @@ -217,13 +218,16 @@ The address and the user can be unlinked by sending a DELETE request on the You can link an existing user to an address by passing the user's ID in the POST request. +:: >>> dump_json('http://localhost:9001/3.0/addresses/cris@example.com/user', ... {'user_id': 1}) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... server: ... status: 200 + >>> dump_json('http://localhost:9001/3.0/addresses/cris@example.com/user') created_on: ... display_name: Cris X. Person @@ -234,14 +238,17 @@ POST request. To link an address to a different user, you can either send a DELETE request followed by a POST request, or you can send a PUT request. +:: >>> dump_json('http://localhost:9001/3.0/addresses/cris@example.com/user', ... {'display_name': 'Cris Q Person'}, method="PUT") content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/users/2 server: ... status: 201 + >>> dump_json('http://localhost:9001/3.0/addresses/cris@example.com/user') created_on: ... display_name: Cris Q Person @@ -290,6 +297,7 @@ addresses to an existing user. ... 'email': 'dave.person@example.org' ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/addresses/dave.person@example.org server: ... @@ -303,6 +311,7 @@ When you add the new address, you can give it an optional display name. ... 'display_name': 'Davie P', ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/addresses/dp@example.org server: ... diff --git a/src/mailman/rest/docs/domains.rst b/src/mailman/rest/docs/domains.rst index 34e3b9a18..89c03d170 100644 --- a/src/mailman/rest/docs/domains.rst +++ b/src/mailman/rest/docs/domains.rst @@ -111,6 +111,7 @@ example.com domain does not contain any mailing lists. ... 'fqdn_listname': 'test-domains@example.com', ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/lists/test-domains.example.com ... @@ -145,6 +146,7 @@ New domains can be created by posting to the ``domains`` url. ... 'mail_host': 'lists.example.com', ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/domains/lists.example.com ... @@ -178,6 +180,7 @@ address. ... 'base_url': 'http://allmy.example.com' ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/domains/my.example.com ... @@ -273,6 +276,7 @@ New domains can be created with owners. ... ('owner', 'bart@example.com'), ... )) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/domains/your.example.com server: ... diff --git a/src/mailman/rest/docs/lists.rst b/src/mailman/rest/docs/lists.rst index 49f2d454e..6554b04c2 100644 --- a/src/mailman/rest/docs/lists.rst +++ b/src/mailman/rest/docs/lists.rst @@ -105,6 +105,7 @@ New mailing lists can also be created through the API, by posting to the ... 'fqdn_listname': 'bee@example.com', ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/lists/bee.example.com ... @@ -179,6 +180,7 @@ different style. ... 'style_name': 'legacy-announce', ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/lists/cat.example.com ... @@ -341,6 +343,7 @@ can force the digest to be sent. ... 'send': True, ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... Once the runner does its thing, the digest message will be sent. @@ -389,6 +392,7 @@ Let's bump the digest. ... 'bump': True, ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... And now the next digest to be sent will have a new volume number. diff --git a/src/mailman/rest/docs/membership.rst b/src/mailman/rest/docs/membership.rst index 24065ba07..6ab2a7e8d 100644 --- a/src/mailman/rest/docs/membership.rst +++ b/src/mailman/rest/docs/membership.rst @@ -302,6 +302,7 @@ mailing list. ... 'role': 'moderator', ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/members/6 server: ... @@ -313,6 +314,7 @@ mailing list. ... 'role': 'owner', ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/members/7 server: ... @@ -643,6 +645,7 @@ won't have to approve her subscription request. ... 'pre_approved': True, ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/members/8 server: ... @@ -699,6 +702,7 @@ list with her preferred address. ... 'pre_approved': True, ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/members/9 server: ... diff --git a/src/mailman/rest/docs/queues.rst b/src/mailman/rest/docs/queues.rst index df2753dc4..15f092113 100644 --- a/src/mailman/rest/docs/queues.rst +++ b/src/mailman/rest/docs/queues.rst @@ -118,6 +118,7 @@ existing mailing list. ... 'fqdn_listname': 'ant@example.com', ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/lists/ant.example.com server: WSGIServer/0.2 CPython/... @@ -135,6 +136,7 @@ requires a List ID. ... ... """}) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/queues/bad/... server: ... diff --git a/src/mailman/rest/docs/users.rst b/src/mailman/rest/docs/users.rst index 6c12093ca..76251d258 100644 --- a/src/mailman/rest/docs/users.rst +++ b/src/mailman/rest/docs/users.rst @@ -108,6 +108,7 @@ the user's email address must be provided. ... 'email': 'cris@example.com', ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/users/3 server: ... @@ -154,6 +155,7 @@ When a user is added, a display name can be provided. ... 'display_name': 'Dave Person', ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/users/4 server: ... @@ -186,6 +188,7 @@ before being stored. ... 'password': 'supersekrit', ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/users/5 server: ... @@ -483,6 +486,7 @@ Gwen, a new users, takes over as a server owner. ... 'is_server_owner': True, ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/users/7 server: ... @@ -519,6 +523,7 @@ Now, a user creation request is received, using Herb's email address. ... 'display_name': 'Herb Person', ... }) content-length: 0 + content-type: application/json; charset=UTF-8 date: ... location: http://localhost:9001/3.0/users/8 server: ... diff --git a/src/mailman/rest/lists.py b/src/mailman/rest/lists.py index 417db4839..c26e4702a 100644 --- a/src/mailman/rest/lists.py +++ b/src/mailman/rest/lists.py @@ -139,7 +139,7 @@ class AList(_ListBase): no_content(response) @child(member_matcher) - def member(self, request, segments, role, email): + def member(self, context, segments, role, email): """Return a single member representation.""" if self._mlist is None: return NotFound(), [] @@ -147,7 +147,7 @@ class AList(_ListBase): email, self._mlist.list_id, role) if member is None: return NotFound(), [] - return AMember(request.context['api'], member.member_id) + return AMember(context['api'], member.member_id) @child(roster_matcher) def roster(self, request, segments, role): diff --git a/src/mailman/rest/users.py b/src/mailman/rest/users.py index fe5641ddc..dfef466ca 100644 --- a/src/mailman/rest/users.py +++ b/src/mailman/rest/users.py @@ -301,7 +301,6 @@ class AddressUser(_UserBase): def on_post(self, request, response): """Link a user to the address, and create it if needed.""" - import pdb; pdb.set_trace() if self._user: conflict(response) return @@ -344,12 +343,11 @@ class AddressUser(_UserBase): def on_put(self, request, response): """Set or replace the addresses's user.""" - api = request.context['api'] if self._user: self._user.unlink(self._address) # Process post data and check for an existing user. fields = CREATION_FIELDS.copy() - fields['user_id'] = api.to_uuid + fields['user_id'] = self.api.to_uuid fields['_optional'] = fields['_optional'] + ( 'user_id', 'email', 'is_server_owner') try: diff --git a/src/mailman/rest/wsgiapp.py b/src/mailman/rest/wsgiapp.py index c7e7bfea0..766c4de03 100644 --- a/src/mailman/rest/wsgiapp.py +++ b/src/mailman/rest/wsgiapp.py @@ -203,6 +203,7 @@ class RootedAPI(API): middleware=Middleware(), router=ObjectRouter(root), **kws) + self.req_options.auto_parse_form_urlencoded = True @transactional def __call__(self, environ, start_response): |
