Commit cc2d2a8b authored by Abhilash Raj's avatar Abhilash Raj

Merge branch 'list-owners' into 'master'

Return the list of Owners as User objects instead of json

See merge request !63
parents aa8ad29a 3c0b2502
Pipeline #22004843 failed with stage
in 2 minutes and 45 seconds
......@@ -3,7 +3,7 @@ NEWS for mailmanclient
=======================
3.1.2 (201X-XX-XX)
3.2.0 (201X-XX-XX)
==================
Changes
......@@ -23,6 +23,12 @@ Backwards Incompatible Changes
Backwards Incompatible Changes
-------------------------------
* `Domain.owners` now returns a list of `User` objects instead of just a dictionary of
JSON response. (!63)
3.1.1 (2017-10-07)
==================
......
......@@ -17,6 +17,7 @@ import warnings
from mailmanclient.restobjects.mailinglist import MailingList
from mailmanclient.restobjects.templates import TemplateList
from mailmanclient.restobjects.user import User
from mailmanclient.restbase.base import RESTObject
from mailmanclient.restbase.page import Page
......@@ -59,7 +60,8 @@ class Domain(RESTObject):
if 'entries' not in content:
return []
else:
return [item for item in content['entries']]
return [User(self._connection, entry['self_link'], entry)
for entry in content['entries']]
@property
def lists(self):
......@@ -89,9 +91,12 @@ class Domain(RESTObject):
response, content = self._connection.call('lists', data)
return MailingList(self._connection, response['location'])
# TODO: Add this when the API supports removing a single owner.
# def remove_owner(self, owner):
# TODO: add this when API supports it.
# pass
# url = self._url + '/owners/{}'.format(owner)
# response, content = self._connection.call(
# url, method='DELETE')
# return response
def remove_all_owners(self):
url = self._url + '/owners'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment