Abhilash Raj has proposed merging lp:~raj-abhilash1/mailman.client/domainowner 
into lp:mailman.client.

Requested reviews:
  Mailman Coders (mailman-coders)

For more details, see:
https://code.launchpad.net/~raj-abhilash1/mailman.client/domainowner/+merge/256240

Add options for domainowner and remove contact_address field
-- 
Your team Mailman Coders is requested to review the proposed merge of 
lp:~raj-abhilash1/mailman.client/domainowner into lp:mailman.client.
=== 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 @@
         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,22 @@
             '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})
+        pass
+
 
 class _List:
 

_______________________________________________
Mailman-coders mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-coders

Reply via email to