------------------------------------------------------------
revno: 39
committer: Florian Fuchs <[email protected]>
branch nick: mailman.client
timestamp: Sun 2013-03-17 11:17:30 -0700
message:
* moved some class definitions
* item access for _Addresses objects
modified:
src/mailmanclient/_client.py
--
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 2013-03-15 23:02:04 +0000
+++ src/mailmanclient/_client.py 2013-03-17 18:17:30 +0000
@@ -672,31 +672,14 @@
self._addresses = []
self._addresses = content['entries']
+ def __getitem__(self, key):
+ return _Address(self._connection, self._addresses[key])
+
def __iter__(self):
for address in self._addresses:
yield _Address(self._connection, address)
-class _Preferences:
- def __init__(self, connection, address):
- self._connection = connection
- self._address = address
- self._preferences = None
- self._get_preferences()
-
- def _get_preferences(self):
- if self._preferences is None:
- response, content = self._connection.call(
- 'addresses/{0}/preferences'.format(self._address))
- if 'entries' not in content:
- self._preferences = []
- self._preferences = content['entries']
-
- def __iter__(self):
- for preference in self._preferences:
- yield _Preference(self._connection, preference)
-
-
class _Address:
def __init__(self, connection, address):
self._connection = connection
@@ -738,6 +721,26 @@
self._info = None
+class _Preferences:
+ def __init__(self, connection, address):
+ self._connection = connection
+ self._address = address
+ self._preferences = None
+ self._get_preferences()
+
+ def _get_preferences(self):
+ if self._preferences is None:
+ response, content = self._connection.call(
+ 'addresses/{0}/preferences'.format(self._address))
+ if 'entries' not in content:
+ self._preferences = []
+ self._preferences = content['entries']
+
+ def __iter__(self):
+ for preference in self._preferences:
+ yield _Preference(self._connection, preference)
+
+
LIST_READ_ONLY_ATTRS = ('bounces_address', 'created_at', 'digest_last_sent_at',
'fqdn_listname', 'http_etag', 'mail_host',
'join_address', 'last_post_at', 'leave_address',
_______________________________________________
Mailman-coders mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-coders