Broken REST API to get member from list given email address (and role).

Bug #825570 reported by Stephen A. Goss
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Mailman
Barry Warsaw

Bug Description

There is code in src/mailman/rest/ to allow for the REST API to return a member object given a list, role and email address, but it is currently broken.

the last line of the member function in

        return AMember(self._mlist, role, address)

compare to AMember constructor:

        def __init__(self, member_id):

Attempting to use this part of the API returns a 500 with this traceback:

Traceback (most recent call last):
  File "/usr/lib64/python2.6/wsgiref/", line 93, in run
    self.result = application(self.environ, self.start_response)
  File "/home/sgoss/mailman_clone/src/mailman/rest/", line 58, in __call__
    environ, start_response)
  File "/home/sgoss/phoenix-deploy/lib/python2.6/site-packages/restish-0.12.1-py2.6.egg/restish/", line 17, in __call__
    resource_or_response = self.locate_resource(request)
  File "/home/sgoss/phoenix-deploy/lib/python2.6/site-packages/restish-0.12.1-py2.6.egg/restish/", line 44, in locate_resource
    result = resource_child(request, segments)
  File "/home/sgoss/phoenix-deploy/lib/python2.6/site-packages/restish-0.12.1-py2.6.egg/restish/", line 194, in resource_child
    result = func(self, request, segments, *match_args, **match_kwargs)
  File "/home/sgoss/mailman_clone/src/mailman/rest/", line 152, in member
    return AMember(self._mlist, role, address)
TypeError: __init__() takes exactly 2 arguments (4 given)

Revision history for this message
Stephen A. Goss (postfuturist) wrote :

The attached patch fixes this issue, but ignores the "role" aspect, so it just looks for a member with that address in that list.
This gives the following endpoint:


This fits my use case, otherwise I would have to get a list of all members of a list to find the one with a given email address.

Barry Warsaw (barry)
Changed in mailman:
status: New → Confirmed
milestone: none → 3.0.0a8
assignee: nobody → Barry Warsaw (barry)
importance: Undecided → Medium
Revision history for this message
Barry Warsaw (barry) wrote :

I have a fix ready to go that preserves the role argument. If you're looking for an API that doesn't require the role, the new /members/find API is the one to use. In fact, this one might be redundant.

"Untested code is broken code" ;)

Changed in mailman:
status: Confirmed → Fix Committed
Barry Warsaw (barry)
Changed in mailman:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers