Merge lp:~raj-abhilash1/mailman.client/domainowner into lp:mailman.client

Proposed by Abhilash Raj
Status: Merged
Merged at revision: 70
Proposed branch: lp:~raj-abhilash1/mailman.client/domainowner
Merge into: lp:mailman.client
Diff against target: 59 lines (+26/-5)
1 file modified
src/mailmanclient/_client.py (+26/-5)
To merge this branch: bzr merge lp:~raj-abhilash1/mailman.client/domainowner
Reviewer Review Type Date Requested Status
Mailman Coders Pending
Review via email: mp+256240@code.launchpad.net

Description of the change

Add options for domainowner and remove contact_address field

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/mailmanclient/_client.py'
2--- src/mailmanclient/_client.py 2015-04-11 22:33:16 +0000
3+++ src/mailmanclient/_client.py 2015-04-14 22:07:59 +0000
4@@ -199,13 +199,14 @@
5 return _Page(self._connection, 'users', _User, count, page)
6
7 def create_domain(self, mail_host, base_url=None,
8- description=None, contact_address=None):
9- # `contact_address` is deprecated but still accepted.
10+ description=None, owner=None):
11 data = dict(mail_host=mail_host)
12 if base_url is not None:
13 data['base_url'] = base_url
14 if description is not None:
15 data['description'] = description
16+ if owner is not None:
17+ data['owner'] = owner
18 response, content = self._connection.call('domains', data)
19 return _Domain(self._connection, response['location'])
20
21@@ -278,9 +279,13 @@
22 return self._info['base_url']
23
24 @property
25- def contact_address(self):
26- self._get_info()
27- return self._info['contact_address']
28+ def owners(self):
29+ url = self._url + '/owners'
30+ response, content = self._connection.call(url)
31+ if 'entries' not in content:
32+ return []
33+ else:
34+ return [item for item in content['entries']]
35
36 @property
37 def description(self):
38@@ -313,6 +318,22 @@
39 'lists', dict(fqdn_listname=fqdn_listname))
40 return _List(self._connection, response['location'])
41
42+ # def remove_owner(self, owner):
43+ # TODO: add this when API supports it.
44+ # pass
45+
46+ def remove_all_owners(self):
47+ url = self._url + '/owners'
48+ response, content = self._connection.call(
49+ url, method='DELETE')
50+ return response
51+
52+ def add_owner(self, owner):
53+ url = self._url + '/owners'
54+ response, content = self._connection.call(
55+ url, {'owner': owner})
56+ pass
57+
58
59 class _List:
60

Subscribers

People subscribed via source and target branches