------------------------------------------------------------
revno: 23
committer: Florian Fuchs <[email protected]>
branch nick: mailman.client
timestamp: Tue 2012-02-07 06:55:59 +0100
message:
- added a `get` method to the settings class to support more dictionary-like
behaviour
modified:
mailman/client/_client.py
mailman/client/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 'mailman/client/_client.py'
--- mailman/client/_client.py 2011-11-14 14:07:48 +0000
+++ mailman/client/_client.py 2012-02-07 05:55:59 +0000
@@ -547,6 +547,12 @@
def __len__(self):
return len(self._info)
+ def get(self, key, default=None):
+ try:
+ return self._info[key]
+ except KeyError:
+ return default
+
def save(self):
data = {}
for attribute, value in self._info.items():
=== modified file 'mailman/client/docs/using.txt'
--- mailman/client/docs/using.txt 2011-10-31 22:42:40 +0000
+++ mailman/client/docs/using.txt 2012-02-07 05:55:59 +0000
@@ -310,6 +310,11 @@
>>> print settings_new['real_name']
Test Numero Uno
+The settings object also supports the `get` method of usual Python dictionaries:
+
+ >>> print settings_new.get('OhNoIForGotTheKey', 'HowGoodIPlacedOneUnderTheDoormat')
+ HowGoodIPlacedOneUnderTheDoormat
+
Preferences
===========
_______________________________________________
Mailman-coders mailing list
[email protected]
http://mail.python.org/mailman/listinfo/mailman-coders