diff options
Diffstat (limited to 'Mailman/docs/users.txt')
| -rw-r--r-- | Mailman/docs/users.txt | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/Mailman/docs/users.txt b/Mailman/docs/users.txt index 130c97210..d346d37fe 100644 --- a/Mailman/docs/users.txt +++ b/Mailman/docs/users.txt @@ -7,7 +7,6 @@ they control. See usermanager.txt for examples of how to create, delete, and find users. - >>> from Mailman.database import flush >>> from Mailman.configuration import config >>> usermgr = config.db.user_manager @@ -18,23 +17,21 @@ User data Users may have a real name and a password. >>> user_1 = usermgr.create_user() - >>> user_1.password = 'my password' - >>> user_1.real_name = 'Zoe Person' - >>> flush() + >>> user_1.password = u'my password' + >>> user_1.real_name = u'Zoe Person' >>> sorted(user.real_name for user in usermgr.users) - ['Zoe Person'] + [u'Zoe Person'] >>> sorted(user.password for user in usermgr.users) - ['my password'] + [u'my password'] The password and real name can be changed at any time. - >>> user_1.real_name = 'Zoe X. Person' - >>> user_1.password = 'another password' - >>> flush() + >>> user_1.real_name = u'Zoe X. Person' + >>> user_1.password = u'another password' >>> sorted(user.real_name for user in usermgr.users) - ['Zoe X. Person'] + [u'Zoe X. Person'] >>> sorted(user.password for user in usermgr.users) - ['another password'] + [u'another password'] Users addresses @@ -47,25 +44,23 @@ 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('zperson@example.com', 'Zoe Person') + >>> user_1.register(u'zperson@example.com', u'Zoe Person') <Address: Zoe Person <zperson@example.com> [not verified] at 0x...> - >>> user_1.register('zperson@example.org') + >>> user_1.register(u'zperson@example.org') <Address: zperson@example.org [not verified] at 0x...> - >>> flush() >>> sorted(address.address for address in user_1.addresses) - ['zperson@example.com', 'zperson@example.org'] + [u'zperson@example.com', u'zperson@example.org'] >>> sorted(address.real_name for address in user_1.addresses) - ['', 'Zoe Person'] + [u'', u'Zoe Person'] You can also create the address separately and then link it to the user. - >>> address_1 = usermgr.create_address('zperson@example.net') + >>> address_1 = usermgr.create_address(u'zperson@example.net') >>> user_1.link(address_1) - >>> flush() >>> sorted(address.address for address in user_1.addresses) - ['zperson@example.com', 'zperson@example.net', 'zperson@example.org'] + [u'zperson@example.com', u'zperson@example.net', u'zperson@example.org'] >>> sorted(address.real_name for address in user_1.addresses) - ['', '', 'Zoe Person'] + [u'', u'', u'Zoe Person'] But don't try to link an address to more than one user. @@ -79,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('bperson@example.com') + >>> user_1.controls(u'bperson@example.com') False Given a text email address, the user manager can find the user that controls that address. - >>> usermgr.get_user('zperson@example.com') is user_1 + >>> usermgr.get_user(u'zperson@example.com') is user_1 True - >>> usermgr.get_user('zperson@example.net') is user_1 + >>> usermgr.get_user(u'zperson@example.net') is user_1 True - >>> usermgr.get_user('zperson@example.org') is user_1 + >>> usermgr.get_user(u'zperson@example.org') is user_1 True - >>> print usermgr.get_user('bperson@example.com') + >>> print usermgr.get_user(u'bperson@example.com') None Addresses can also be unlinked from a user. >>> user_1.unlink(address_1) - >>> user_1.controls('zperson@example.net') + >>> user_1.controls(u'zperson@example.net') False - >>> print usermgr.get_user('aperson@example.net') + >>> print usermgr.get_user(u'aperson@example.net') None But don't try to unlink the address from a user it's not linked to. @@ -141,11 +136,10 @@ Some of these preferences are booleans and they can be set to True or False. >>> from Mailman.constants import DeliveryMode >>> prefs = user_1.preferences >>> prefs.acknowledge_posts = True - >>> prefs.preferred_language = 'it' + >>> prefs.preferred_language = u'it' >>> prefs.receive_list_copy = False >>> prefs.receive_own_postings = False >>> prefs.delivery_mode = DeliveryMode.regular - >>> flush() >>> show_prefs(user_1.preferences) acknowledge_posts : True preferred_language : it |
