diff options
Diffstat (limited to 'src/mailman/docs/users.txt')
| -rw-r--r-- | src/mailman/docs/users.txt | 56 |
1 files changed, 29 insertions, 27 deletions
diff --git a/src/mailman/docs/users.txt b/src/mailman/docs/users.txt index b557a280d..ef4f3062b 100644 --- a/src/mailman/docs/users.txt +++ b/src/mailman/docs/users.txt @@ -1,3 +1,4 @@ +===== Users ===== @@ -11,13 +12,13 @@ See usermanager.txt for examples of how to create, delete, and find users. User data ---------- +========= Users may have a real name and a password. >>> user_1 = usermgr.create_user() - >>> user_1.password = u'my password' - >>> user_1.real_name = u'Zoe Person' + >>> user_1.password = 'my password' + >>> user_1.real_name = 'Zoe Person' >>> sorted(user.real_name for user in usermgr.users) [u'Zoe Person'] >>> sorted(user.password for user in usermgr.users) @@ -25,8 +26,8 @@ Users may have a real name and a password. The password and real name can be changed at any time. - >>> user_1.real_name = u'Zoe X. Person' - >>> user_1.password = u'another password' + >>> user_1.real_name = 'Zoe X. Person' + >>> user_1.password = 'another password' >>> sorted(user.real_name for user in usermgr.users) [u'Zoe X. Person'] >>> sorted(user.password for user in usermgr.users) @@ -34,7 +35,7 @@ The password and real name can be changed at any time. Users addresses ---------------- +=============== One of the pieces of information that a user links to is a set of email addresses they control, in the form of IAddress objects. A user can control @@ -43,9 +44,9 @@ many addresses, but addresses may be controlled by only one user. The easiest way to link a user to an address is to just register the new address on a user object. - >>> user_1.register(u'zperson@example.com', u'Zoe Person') + >>> user_1.register('zperson@example.com', 'Zoe Person') <Address: Zoe Person <zperson@example.com> [not verified] at 0x...> - >>> user_1.register(u'zperson@example.org') + >>> user_1.register('zperson@example.org') <Address: zperson@example.org [not verified] at 0x...> >>> sorted(address.address for address in user_1.addresses) [u'zperson@example.com', u'zperson@example.org'] @@ -54,7 +55,7 @@ address on a user object. You can also create the address separately and then link it to the user. - >>> address_1 = usermgr.create_address(u'zperson@example.net') + >>> address_1 = usermgr.create_address('zperson@example.net') >>> user_1.link(address_1) >>> sorted(address.address for address in user_1.addresses) [u'zperson@example.com', u'zperson@example.net', u'zperson@example.org'] @@ -73,27 +74,27 @@ You can also ask whether a given user controls a given address. >>> user_1.controls(address_1.address) True - >>> user_1.controls(u'bperson@example.com') + >>> user_1.controls('bperson@example.com') False Given a text email address, the user manager can find the user that controls that address. - >>> usermgr.get_user(u'zperson@example.com') is user_1 + >>> usermgr.get_user('zperson@example.com') is user_1 True - >>> usermgr.get_user(u'zperson@example.net') is user_1 + >>> usermgr.get_user('zperson@example.net') is user_1 True - >>> usermgr.get_user(u'zperson@example.org') is user_1 + >>> usermgr.get_user('zperson@example.org') is user_1 True - >>> print usermgr.get_user(u'bperson@example.com') + >>> print usermgr.get_user('bperson@example.com') None Addresses can also be unlinked from a user. >>> user_1.unlink(address_1) - >>> user_1.controls(u'zperson@example.net') + >>> user_1.controls('zperson@example.net') False - >>> print usermgr.get_user(u'aperson@example.net') + >>> print usermgr.get_user('aperson@example.net') None But don't try to unlink the address from a user it's not linked to. @@ -109,7 +110,7 @@ But don't try to unlink the address from a user it's not linked to. Users and preferences ---------------------- +===================== This is a helper function for the following section. @@ -132,12 +133,12 @@ Users have preferences, but these preferences have no default settings. Some of these preferences are booleans and they can be set to True or False. - >>> config.languages.add(u'it', u'iso-8859-1', u'Italian') + >>> config.languages.add('it', 'iso-8859-1', 'Italian') >>> from mailman.constants import DeliveryMode >>> prefs = user_1.preferences >>> prefs.acknowledge_posts = True - >>> prefs.preferred_language = u'it' + >>> prefs.preferred_language = 'it' >>> prefs.receive_list_copy = False >>> prefs.receive_own_postings = False >>> prefs.delivery_mode = DeliveryMode.regular @@ -150,7 +151,7 @@ Some of these preferences are booleans and they can be set to True or False. Subscriptions -------------- +============= Users know which mailing lists they are subscribed to, regardless of membership role. @@ -158,14 +159,14 @@ membership role. >>> user_1.link(address_1) >>> sorted(address.address for address in user_1.addresses) [u'zperson@example.com', u'zperson@example.net', u'zperson@example.org'] - >>> com = usermgr.get_address(u'zperson@example.com') - >>> org = usermgr.get_address(u'zperson@example.org') - >>> net = usermgr.get_address(u'zperson@example.net') + >>> com = usermgr.get_address('zperson@example.com') + >>> org = usermgr.get_address('zperson@example.org') + >>> net = usermgr.get_address('zperson@example.net') >>> from mailman.app.lifecycle import create_list - >>> mlist_1 = create_list(u'xtest_1@example.com') - >>> mlist_2 = create_list(u'xtest_2@example.com') - >>> mlist_3 = create_list(u'xtest_3@example.com') + >>> mlist_1 = create_list('xtest_1@example.com') + >>> mlist_2 = create_list('xtest_2@example.com') + >>> mlist_3 = create_list('xtest_3@example.com') >>> from mailman.interfaces.member import MemberRole >>> com.subscribe(mlist_1, MemberRole.member) @@ -188,7 +189,8 @@ membership role. >>> len(members) 4 >>> def sortkey(member): - ... return member.address.address, member.mailing_list, int(member.role) + ... return (member.address.address, member.mailing_list, + ... int(member.role)) >>> for member in sorted(members, key=sortkey): ... print member.address.address, member.mailing_list, member.role zperson@example.com xtest_1@example.com MemberRole.member |
