Commit 2afd44b8 authored by Abhilash Raj's avatar Abhilash Raj

Make address an optional requirement for find_members.

parent 2400e995
......@@ -9,6 +9,10 @@ NEWS for mailmanclient
* Add ``description`` as a property of ``MailingList``. Initially, this was a
part of ``Preferences`` object, which would mean an additional API call to get
the description of a Mailing List. (Closes #35)
* ``MailingList.get_members`` no longer requires ``address`` as a mandatory
argument which allows searching for all memberships of of a particular role.
Also, ``role`` no longer has a default argument, so that we can search for
all memberships of an address.
3.2.0 (2018-07-10)
......
......@@ -94,12 +94,13 @@ class MailingList(RESTObject):
url = 'lists/{0}/roster/member'.format(self.fqdn_listname)
return Page(self._connection, url, Member, count, page)
def find_members(self, address, role='member', page=None, count=50):
data = {
'subscriber': address,
'role': role,
'list_id': self.list_id,
}
def find_members(self, address=None, role=None, page=None, count=50):
data = {'list_id': self.list_id}
if address:
data['subscriber'] = address
if role:
data['role'] = role
url = 'members/find?{}'.format(urlencode(data, doseq=True))
if page is None:
response, content = self._connection.call(url, data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment