Commit c7998081 authored by Florian Fuchs's avatar Florian Fuchs

* Introduced a dict-like ``archivers`` property.

* Removed the list class's set_archiver method. 
* Updated docs.
* Updated vcr yaml data.
parent 55bdc9c3
......@@ -452,20 +452,8 @@ class _List:
Returns a dict of all available archivers, along with their
activation status.
response, content =
# Remove `http_etag` property.
return content
def set_archiver(self, archiver_name, enabled):
Updates the status of a single archiver.
response, content =
{archiver_name: enabled},
url = 'lists/{0}/archivers'.format(self.list_id)
return _ListArchivers(self._connection, url, self)
def add_owner(self, address):
self.add_role('owner', address)
......@@ -572,6 +560,45 @@ class _List:
'lists/{0}'.format(self.fqdn_listname), None, 'DELETE')
class _ListArchivers:
def __init__(self, connection, url, list_obj):
self._connection = connection
self._url = url
self._list_obj = list_obj
self._info = None
def __repr__(self):
return '<Archivers on "{0}">'.format(self._list_obj.list_id)
def _get_info(self):
if self._info is None:
response, content =
# Remove `http_etag` from dictionary.
self._info = content
def __iter__(self):
for archiver in self._info:
yield self._info[archiver]
def __getitem__(self, key):
return self._info[key]
def __setitem__(self, key, value):
self._info[key] = value, self._info, method='PUT')
def keys(self):
for key in self._info:
yield key
class _Member:
def __init__(self, connection, url):
Mailman REST client
......@@ -693,18 +693,38 @@ Archivers
Each list object has an ``archivers`` attribute holding a dictionary which
contains the activation status of all available archivers.
Each list object has an ``archivers`` attribute.
>>> archivers = test_one.archivers
>>> print(archivers)
<Archivers on "">
The activation status of each available archiver can be accessed like a
key in a dictionary.
>>> archivers = test_one.archivers
>>> archivers = test_one.archivers
>>> for archiver in sorted(archivers.keys()):
... print('{0}: {1}'.format(archiver, archivers[archiver]))
mail-archive: True
mhonarc: True
prototype: False
Each archiver's status can be changed with the ``set_archiver`` method.
>>> archivers['mail-archive']
>>> archivers['mhonarc']
>>> test_one.set_archiver('mhonarc', False)
>>> test_one.archivers['mhonarc']
They can also be set like items in dictionary.
>>> archivers['mail-archive'] = False
>>> archivers['mhonarc'] = False
So if we get a new ``archivers`` object from the API (by accessing the
list's archiver attribute again), we can see that the archiver stati
have now been set.
>>> archivers = test_one.archivers
>>> archivers['mail-archive']
>>> archivers['mhonarc']
This source diff could not be displayed because it is too large. You can view the blob instead.
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