Navigation Menu

Skip to content

Commit

Permalink
Modified unsubscribe method of Client._List to pass mode of unsubscri…
Browse files Browse the repository at this point in the history
…ption
  • Loading branch information
khushboo9293 committed Jun 14, 2015
1 parent e6aee8e commit 8339755
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mailmanclient/_client.py
Expand Up @@ -606,17 +606,18 @@ def subscribe(self, address, display_name=None, pre_verified=False,
# is returned.
return _Member(self._connection, response['location'])

def unsubscribe(self, email):
def unsubscribe(self, email, mode):
"""Unsubscribe an email address from a mailing list.
:param address: The address to unsubscribe.
"""
# In order to get the member object we need to
# iterate over the existing member list

data = {'mode': mode}
for member in self.members:
if member.email == email:
self._connection.call(member.self_link, method='DELETE')
self._connection.call(member.self_link, data=data, method='DELETE')
break
else:
raise ValueError('%s is not a member address of %s' %
Expand Down

0 comments on commit 8339755

Please sign in to comment.