------------------------------------------------------------
revno: 52
committer: Florian Fuchs <[email protected]>
branch nick: mailman.client
timestamp: Mon 2014-04-14 18:03:43 -0400
message:
added nonmember property to list objects.
added add_address method to user objects.
modified:
setup.py
src/mailmanclient/_client.py
src/mailmanclient/docs/using.txt
--
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 'setup.py'
--- setup.py 2013-03-19 17:27:11 +0000
+++ setup.py 2014-04-14 22:03:43 +0000
@@ -24,12 +24,11 @@
require_python(0x20600f0)
-__version__ = get_version('src/mailmanclient/__init__.py')
setup(
name='mailmanclient',
- version=__version__,
+ version='1.0.0a1',
packages=find_packages('src'),
package_dir = {'': 'src'},
include_package_data=True,
=== modified file 'src/mailmanclient/_client.py'
--- src/mailmanclient/_client.py 2014-03-15 20:43:52 +0000
+++ src/mailmanclient/_client.py 2014-04-14 22:03:43 +0000
@@ -381,6 +381,20 @@
for entry in sorted(content['entries'],
key=itemgetter('address'))]
+ @property
+ def nonmembers(self):
+ url = 'members/find'
+ data = {
+ 'role': 'nonmember',
+ 'list_id': self.list_id
+ }
+ response, content = self._connection.call(url, data)
+ if 'entries' not in content:
+ return []
+ return [_Member(self._connection, entry['self_link'])
+ for entry in sorted(content['entries'],
+ key=itemgetter('address'))]
+
def get_member_page(self, count=50, page=1):
url = 'lists/{0}/roster/member'.format(self.fqdn_listname)
return _Page(self._connection, url, _Member, count, page)
@@ -690,6 +704,12 @@
self._preferences = _Preferences(self._connection, path)
return self._preferences
+ def add_address(self, email):
+ # Adds another email adress to the user record and returns an
+ # _Address object.
+ url = '{0}/addresses'.format(self._url)
+ self._connection.call(url, {'email': email})
+
def save(self):
data = {'display_name': self.display_name}
if self._cleartext_password is not None:
=== modified file 'src/mailmanclient/docs/using.txt'
--- src/mailmanclient/docs/using.txt 2014-03-15 17:38:56 +0000
+++ src/mailmanclient/docs/using.txt 2014-04-14 22:03:43 +0000
@@ -302,6 +302,7 @@
After a while, Anna decides to unsubscribe from the Test One mailing list,
though she keeps her Test Two membership active.
+ >>> time.sleep(2)
>>> test_one.unsubscribe('[email protected]')
>>> for member in client.members:
... print member
@@ -336,7 +337,7 @@
<User "..." (...)>
<User "..." (...)>
-The users can also be paginated:
+The list of users can also be paginated:
>>> page = client.get_user_page(count=2, page=1)
>>> page.nr
@@ -381,6 +382,21 @@
[email protected]
Cris
...
+
+Multiple addresses can be assigned to a user record:
+
+ >>> cris.add_address('[email protected]')
+ >>> print client.get_address('[email protected]')
+ [email protected]
+
+ >>> for address in cris.addresses:
+ ... print address
+ [email protected]
+ [email protected]
+
+
+Addresses
+=========
Addresses can be accessed directly:
_______________________________________________
Mailman-coders mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-coders