Merge authors:
  Florian Fuchs (flo-fuchs)
------------------------------------------------------------
revno: 56 [merge]
committer: Florian Fuchs <[email protected]>
branch nick: mailman.client
timestamp: Tue 2014-04-22 14:47:00 +0200
message:
  * Member's email addresses are now exposed by the ``email`` property
    (``address`` property kept for compatibility reasons in mailman.client)
  * Removed subscription moderation test case, since this is currently not
    exposed by mailman's REST API.
modified:
  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 'src/mailmanclient/_client.py'
--- src/mailmanclient/_client.py	2014-04-16 18:42:04 +0000
+++ src/mailmanclient/_client.py	2014-04-22 12:35:29 +0000
@@ -338,7 +338,7 @@
         if 'entries' not in content:
             return []
         else:
-            return [item['address'] for item in content['entries']]
+            return [item['email'] for item in content['entries']]
 
     @property
     def moderators(self):
@@ -347,7 +347,7 @@
         if 'entries' not in content:
             return []
         else:
-            return [item['address'] for item in content['entries']]
+            return [item['email'] for item in content['entries']]
 
     @property
     def fqdn_listname(self):
@@ -505,7 +505,7 @@
         """
         return self.moderate_message(request_id, 'accept')
 
-    def get_member(self, address):
+    def get_member(self, email):
         """Get a membership.
 
         :param address: The email address of the member for this list.
@@ -514,12 +514,12 @@
         # In order to get the member object we need to
         # iterate over the existing member list
         for member in self.members:
-            if member.address == address:
+            if member.email == email:
                 return member
                 break
         else:
             raise ValueError('%s is not a member address of %s' %
-                             (address, self.fqdn_listname))
+                             (email, self.fqdn_listname))
 
     def subscribe(self, address, display_name=None):
         """Subscribe an email address to a mailing list.
@@ -538,7 +538,7 @@
         response, content = self._connection.call('members', data)
         return _Member(self._connection, response['location'])
 
-    def unsubscribe(self, address):
+    def unsubscribe(self, email):
         """Unsubscribe an email address from a mailing list.
 
         :param address: The address to unsubscribe.
@@ -547,12 +547,12 @@
         # iterate over the existing member list
 
         for member in self.members:
-            if member.address == address:
+            if member.email == email:
                 self._connection.call(member.self_link, method='DELETE')
                 break
         else:
             raise ValueError('%s is not a member address of %s' %
-                             (address, self.fqdn_listname))
+                             (email, self.fqdn_listname))
 
     def delete(self):
         response, content = self._connection.call(
@@ -569,7 +569,7 @@
 
     def __repr__(self):
         return '<Member "{0}" on "{1}">'.format(
-            self.address, self.list_id)
+            self.email, self.list_id)
 
     def _get_info(self):
         if self._info is None:
@@ -584,7 +584,12 @@
     @property
     def address(self):
         self._get_info()
-        return self._info['address']
+        return self._info['email']
+
+    @property
+    def email(self):
+        self._get_info()
+        return self._info['email']
 
     @property
     def self_link(self):

=== modified file 'src/mailmanclient/docs/using.txt'
--- src/mailmanclient/docs/using.txt	2014-04-17 14:58:10 +0000
+++ src/mailmanclient/docs/using.txt	2014-04-22 12:47:00 +0000
@@ -668,42 +668,3 @@
 
     >>> len(test_one.held)
     0
-
-
-Subscription Moderation
------------------------
-
-    >>> patcher = patch('mailmanclient._client._Connection.call')
-    >>> mock_call = patcher.start()
-    >>> mock_call.return_value = [None, dict(entries=[
-    ...     dict(address=u'[email protected]',
-    ...          delivery_mode=u'regular',
-    ...          display_name=u'Ler',
-    ...          http_etag=u'...',
-    ...          language=u'en',
-    ...          password=u'password',
-    ...          request_id=1,
-    ...          type=u'subscription',
-    ...          when=u'2005-08-01T07:49:23',
-    ...     )
-    ... ])]
-
-    >>> requests = test_one.requests
-    >>> print requests[0]['address']
-    [email protected]
-    >>> print requests[0]['delivery_mode']
-    regular
-    >>> print requests[0]['display_name']
-    Ler
-    >>> print requests[0]['language']
-    en
-    >>> print requests[0]['password']
-    password
-    >>> print requests[0]['request_id']
-    1
-    >>> print requests[0]['type']
-    subscription
-    >>> print requests[0]['request_date']
-    2005-08-01T07:49:23
-
-    >>> patcher.stop()

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

Reply via email to