Merge authors:
Abhilash Raj (raj-abhilash1)
Related merge proposals:
https://code.launchpad.net/~raj-abhilash1/mailman.client/domainowner/+merge/256240
proposed by: Abhilash Raj (raj-abhilash1)
------------------------------------------------------------
revno: 70 [merge]
committer: Florian Fuchs <[email protected]>
branch nick: mailman.client
timestamp: Fri 2015-04-17 19:05:16 -0400
message:
Fix adding owners (by Abhilash Raj)
modified:
src/mailmanclient/_client.py
--
lp:mailman.client
https://code.launchpad.net/~mailman-coders/mailman.client/trunk
Your team Mailman Coders is subscribed to branch lp:mailman.client.
To unsubscribe from this branch go to
https://code.launchpad.net/~mailman-coders/mailman.client/trunk/+edit-subscription
=== modified file 'src/mailmanclient/_client.py'
--- src/mailmanclient/_client.py 2015-04-17 19:33:54 +0000
+++ src/mailmanclient/_client.py 2015-04-17 23:05:16 +0000
@@ -199,13 +199,14 @@
return _Page(self._connection, 'users', _User, count, page)
def create_domain(self, mail_host, base_url=None,
- description=None, contact_address=None):
- # `contact_address` is deprecated but still accepted.
+ description=None, owner=None):
data = dict(mail_host=mail_host)
if base_url is not None:
data['base_url'] = base_url
if description is not None:
data['description'] = description
+ if owner is not None:
+ data['owner'] = owner
response, content = self._connection.call('domains', data)
return _Domain(self._connection, response['location'])
@@ -278,9 +279,13 @@
return self._info['base_url']
@property
- def contact_address(self):
- self._get_info()
- return self._info['contact_address']
+ def owners(self):
+ url = self._url + '/owners'
+ response, content = self._connection.call(url)
+ if 'entries' not in content:
+ return []
+ else:
+ return [item for item in content['entries']]
@property
def description(self):
@@ -313,6 +318,21 @@
'lists', dict(fqdn_listname=fqdn_listname))
return _List(self._connection, response['location'])
+ # def remove_owner(self, owner):
+ # TODO: add this when API supports it.
+ # pass
+
+ def remove_all_owners(self):
+ url = self._url + '/owners'
+ response, content = self._connection.call(
+ url, method='DELETE')
+ return response
+
+ def add_owner(self, owner):
+ url = self._url + '/owners'
+ response, content = self._connection.call(
+ url, {'owner': owner})
+
class _List:
_______________________________________________
Mailman-coders mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-coders