~barry/mailman/lp1423756

« back to all changes in this revision

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

  • Committer: Barry Warsaw
  • Date: 2015-01-05 01:20:33 UTC
  • mfrom: (7264.4.66 py3)
  • Revision ID: barry@list.org-20150105012033-zdrw9c2odhpf22fz
Merge the Python 3 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
be verified before Mailman will send them any list traffic.
9
9
 
10
10
The ``IUserManager`` manages users, but it does so at a fairly low level.
11
 
Specifically, it does not handle verifications, email address syntax validity
 
11
Specifically, it does not handle verification, email address syntax validity
12
12
checks, etc.  The ``IRegistrar`` is the interface to the object handling all
13
13
this stuff.
14
14
 
19
19
Here is a helper function to check the token strings.
20
20
 
21
21
    >>> def check_token(token):
22
 
    ...     assert isinstance(token, basestring), 'Not a string'
 
22
    ...     assert isinstance(token, str), 'Not a string'
23
23
    ...     assert len(token) == 40, 'Unexpected length: %d' % len(token)
24
24
    ...     assert token.isalnum(), 'Not alphanumeric'
25
25
    ...     print('ok')
47
47
honestly, not as much as probably should be done.  Still, some patently bad
48
48
addresses are rejected outright.
49
49
 
50
 
    >>> registrar.register(mlist, '')
51
 
    Traceback (most recent call last):
52
 
    ...
53
 
    InvalidEmailAddressError
54
 
    >>> registrar.register(mlist, 'some name@example.com')
55
 
    Traceback (most recent call last):
56
 
    ...
57
 
    InvalidEmailAddressError: some name@example.com
58
 
    >>> registrar.register(mlist, '<script>@example.com')
59
 
    Traceback (most recent call last):
60
 
    ...
61
 
    InvalidEmailAddressError: <script>@example.com
62
 
    >>> registrar.register(mlist, '\xa0@example.com')
63
 
    Traceback (most recent call last):
64
 
    ...
65
 
    InvalidEmailAddressError: \xa0@example.com
66
 
    >>> registrar.register(mlist, 'noatsign')
67
 
    Traceback (most recent call last):
68
 
    ...
69
 
    InvalidEmailAddressError: noatsign
70
 
    >>> registrar.register(mlist, 'nodom@ain')
71
 
    Traceback (most recent call last):
72
 
    ...
73
 
    InvalidEmailAddressError: nodom@ain
74
 
 
75
50
 
76
51
Register an email address
77
52
=========================
149
124
    <BLANKLINE>
150
125
    >>> dump_msgdata(items[0].msgdata)
151
126
    _parsemsg           : False
152
 
    listname            : alpha@example.com
 
127
    listid              : alpha.example.com
153
128
    nodecorate          : True
154
 
    recipients          : set([u'aperson@example.com'])
 
129
    recipients          : {'aperson@example.com'}
155
130
    reduced_list_headers: True
156
131
    version             : 3
157
132
 
312
287
If you try to confirm a token that doesn't exist in the pending database, the
313
288
confirm method will just return False.
314
289
 
315
 
    >>> registrar.confirm(bytes('no token'))
 
290
    >>> registrar.confirm(bytes(b'no token'))
316
291
    False
317
292
 
318
293
Likewise, if you try to confirm, through the `IUserRegistrar` interface, a