~nkarageuzian/mailman/bug-1312884

« back to all changes in this revision

Viewing changes to src/mailman/model/docs/usermanager.rst

  • Committer: Barry Warsaw
  • Date: 2014-04-28 15:23:35 UTC
  • Revision ID: barry@list.org-20140428152335-uomli7adnqf3h6dm
Use print functions consistently through, and update all __future__ imports to
reflect this.

Also, mock out sys.stderr on some tests so that their nose2 output is quieter.

A few other minor coding style consistencies.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 
27
27
    >>> dump_list(address.email for address in user.addresses)
28
28
    *Empty*
29
 
    >>> print user.display_name
 
29
    >>> print(user.display_name)
30
30
    <BLANKLINE>
31
 
    >>> print user.password
 
31
    >>> print(user.password)
32
32
    None
33
33
 
34
34
The user has preferences, but none of them will be specified.
35
35
 
36
 
    >>> print user.preferences
 
36
    >>> print(user.preferences)
37
37
    <Preferences ...>
38
38
 
39
39
A user can be assigned a real name.
125
125
If the address is not in the user database or does not have a user associated
126
126
with it, you will get ``None`` back.
127
127
 
128
 
    >>> print user_manager.get_user('zperson@example.com')
 
128
    >>> print(user_manager.get_user('zperson@example.com'))
129
129
    None
130
130
    >>> user_4.unlink(address)
131
 
    >>> print user_manager.get_user(address.email)
 
131
    >>> print(user_manager.get_user(address.email))
132
132
    None
133
133
 
134
134
Users can also be found by their unique user id.
144
144
If a non-existent user id is given, None is returned.
145
145
 
146
146
    >>> from uuid import UUID
147
 
    >>> print user_manager.get_user_by_id(UUID(int=801))
 
147
    >>> print(user_manager.get_user_by_id(UUID(int=801)))
148
148
    None
149
149
 
150
150
 
173
173
    ...     return (member.address.email, member.role.name)
174
174
    >>> members = sorted(user_manager.members, key=sort_key)
175
175
    >>> for member in members:
176
 
    ...     print member.mailing_list.list_id, member.address.email, \
177
 
    ...           member.role
 
176
    ...     print(member.mailing_list.list_id, member.address.email,
 
177
    ...           member.role)
178
178
    test.example.com bperson@example.com MemberRole.member
179
179
    test.example.com bperson@example.com MemberRole.owner
180
180
    test.example.com eperson@example.com MemberRole.member