[Bug 825570] [NEW] Broken REST API to get member from list given email address (and role).

Public bug reported: There is code in src/mailman/rest/lists.py 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 lists.py: 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/handlers.py", line 93, in run self.result = application(self.environ, self.start_response) File "/home/sgoss/mailman_clone/src/mailman/rest/wsgiapp.py", 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/app.py", 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/app.py", 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/resource.py", line 194, in resource_child result = func(self, request, segments, *match_args, **match_kwargs) File "/home/sgoss/mailman_clone/src/mailman/rest/lists.py", line 152, in member return AMember(self._mlist, role, address) TypeError: __init__() takes exactly 2 arguments (4 given) ** Affects: mailman Importance: Undecided Status: New ** Tags: mailman3 -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/825570 Title: Broken REST API to get member from list given email address (and role). To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/825570/+subscriptions

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: /3.0/lists/<listname>/member/<email> 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. ** Patch added: "patch to fix issue" https://bugs.launchpad.net/mailman/+bug/825570/+attachment/2273264/+files/mm... -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/825570 Title: Broken REST API to get member from list given email address (and role). To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/825570/+subscriptions

** Changed in: mailman Status: New => Confirmed ** Changed in: mailman Milestone: None => 3.0.0a8 ** Changed in: mailman Assignee: (unassigned) => Barry Warsaw (barry) ** Changed in: mailman Importance: Undecided => Medium -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/825570 Title: Broken REST API to get member from list given email address (and role). To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/825570/+subscriptions

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 -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/825570 Title: Broken REST API to get member from list given email address (and role). To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/825570/+subscriptions

** Changed in: mailman Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/825570 Title: Broken REST API to get member from list given email address (and role). To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/825570/+subscriptions
participants (2)
-
Barry Warsaw
-
Stephen A. Goss