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
=== modified file 'src/mailmanclient/_client.py'
--- src/mailmanclient/_client.py 2015-04-11 22:33:16 +0000
+++ src/mailmanclient/_client.py 2015-04-14 22:07:59 +0000
@@ -199,13 +199,14 @@
199 return _Page(self._connection, 'users', _User, count, page)199 return _Page(self._connection, 'users', _User, count, page)
200200
201 def create_domain(self, mail_host, base_url=None,201 def create_domain(self, mail_host, base_url=None,
202 description=None, contact_address=None):202 description=None, owner=None):
203 # `contact_address` is deprecated but still accepted.
204 data = dict(mail_host=mail_host)203 data = dict(mail_host=mail_host)
205 if base_url is not None:204 if base_url is not None:
206 data['base_url'] = base_url205 data['base_url'] = base_url
207 if description is not None:206 if description is not None:
208 data['description'] = description207 data['description'] = description
208 if owner is not None:
209 data['owner'] = owner
209 response, content = self._connection.call('domains', data)210 response, content = self._connection.call('domains', data)
210 return _Domain(self._connection, response['location'])211 return _Domain(self._connection, response['location'])
211212
@@ -278,9 +279,13 @@
278 return self._info['base_url']279 return self._info['base_url']
279280
280 @property281 @property
281 def contact_address(self):282 def owners(self):
282 self._get_info()283 url = self._url + '/owners'
283 return self._info['contact_address']284 response, content = self._connection.call(url)
285 if 'entries' not in content:
286 return []
287 else:
288 return [item for item in content['entries']]
284289
285 @property290 @property
286 def description(self):291 def description(self):
@@ -313,6 +318,22 @@
313 'lists', dict(fqdn_listname=fqdn_listname))318 'lists', dict(fqdn_listname=fqdn_listname))
314 return _List(self._connection, response['location'])319 return _List(self._connection, response['location'])
315320
321 # def remove_owner(self, owner):
322 # TODO: add this when API supports it.
323 # pass
324
325 def remove_all_owners(self):
326 url = self._url + '/owners'
327 response, content = self._connection.call(
328 url, method='DELETE')
329 return response
330
331 def add_owner(self, owner):
332 url = self._url + '/owners'
333 response, content = self._connection.call(
334 url, {'owner': owner})
335 pass
336
316337
317class _List:338class _List:
318339

Subscribers

People subscribed via source and target branches