Commit 8ced4750 authored by Florian Fuchs's avatar Florian Fuchs

* fixed real_name key lookup for mass-subscribed members (no real_name)

* added method for held messages
parent 563a371b
......@@ -176,7 +176,7 @@ class Client:
return []
return [_User(self._connection, entry['self_link'])
for entry in sorted(content['entries'],
key=itemgetter('real_name'))]
key=itemgetter('self_link'))]
def create_domain(self, mail_host, base_url=None,
description=None, contact_address=None):
......@@ -314,7 +314,7 @@ class _List:
@property
def real_name(self):
self._get_info()
return self._info['real_name']
return self._info.get('real_name')
@property
def members(self):
......@@ -331,6 +331,10 @@ class _List:
return _Settings(self._connection,
'lists/{0}/config'.format(self.fqdn_listname))
@property
def held(self):
return []
def get_member(self, address):
"""Get a membership.
......@@ -457,7 +461,7 @@ class _User:
@property
def real_name(self):
self._get_info()
return self._info['real_name']
return self._info.get('real_name', None)
@property
def user_id(self):
......@@ -504,7 +508,7 @@ class _Address:
@property
def real_name(self):
return self._address['real_name']
return self._address.get('real_name')
@property
def registered_on(self):
......
......@@ -2,6 +2,8 @@
Mailman REST client
===================
>>> import os
This is the official Python bindings for the GNU Mailman REST API. In order
to talk to Mailman, the engine's REST server must be running. You begin by
instantiating a client object to access the root of the REST hierarchy,
......@@ -255,9 +257,9 @@ Users are people with one or more list memberhips. To get a list of all users, a
>>> for user in client.users:
... print user
<User "Anna" (...)>
<User "Bill" (...)>
<User "Cris" (...)>
<User "..." (...)>
<User "..." (...)>
<User "..." (...)>
A single user can be retrieved using their email address.
......@@ -282,13 +284,13 @@ We can get all list settings via a lists settings attribute. A proxy object for
>>> settings = test_one.settings
>>> len(settings)
48
47
>>> for attr in sorted(settings):
... print attr + ': ' + str(settings[attr])
acceptable_aliases: []
...
welcome_msg:
welcome_message_uri: mailman:///welcome.txt
>>> print settings['real_name']
Test-one
......@@ -340,3 +342,15 @@ By default, preferences are not set and fall back to the global system preferenc
True
Moderation
==========
>>> mm_bindir = os.environ.get('MAILMAN_TEST_BINDIR')
Messages held for moderation can be listed on a per list basis.
>>> test_one.held
[]
......@@ -140,8 +140,7 @@ def teardown(testobj):
def additional_tests():
"Run the doc tests (README.txt and docs/*, if any exist)"
doctest_files = [
os.path.abspath(resource_filename('mailman.client', 'README.txt'))]
doctest_files = []
if resource_exists('mailman.client', 'docs'):
for name in resource_listdir('mailman.client', 'docs'):
if name.endswith('.txt'):
......
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