author | Pascal Volk <user@localhost.localdomain.org> |
Thu, 31 May 2012 18:48:00 +0000 | |
branch | v0.6.x |
changeset 556 | fbbb16476c5b |
parent 216 | 0c8c053b451c |
permissions | -rw-r--r-- |
212
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
1 |
:mod:`VirtualMailManager.EmailAddress` --- Handling of e-mail addresses |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
2 |
======================================================================= |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
3 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
4 |
.. module:: VirtualMailManager.EmailAddress |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
5 |
:synopsis: Handling of e-mail addresses |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
6 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
7 |
.. moduleauthor:: Pascal Volk <neverseen@users.sourceforge.net> |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
8 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
9 |
.. toctree:: |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
10 |
:maxdepth: 2 |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
11 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
12 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
13 |
This module provides the :class:`EmailAddress` class to handle validated e-mail |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
14 |
addresses. |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
15 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
16 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
17 |
EmailAddress |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
18 |
------------ |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
19 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
20 |
.. class:: EmailAddress(address) |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
21 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
22 |
Creates a new EmailAddress instance. |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
23 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
24 |
:param address: string representation of an e-mail addresses |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
25 |
:type address: :obj:`basestring` |
216
0c8c053b451c
Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
212
diff
changeset
|
26 |
:raise VirtualMailManager.errors.EmailAddressError: if the |
212
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
27 |
*address* is syntactically wrong. |
216
0c8c053b451c
Moved VirtualMailManager/Exceptions to VirtualMailManager/errors.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
212
diff
changeset
|
28 |
:raise VirtualMailManager.errors.VMMError: if the validation of the |
212
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
29 |
local-part or domain name fails. |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
30 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
31 |
An EmailAddress instance has the both read-only attributes: |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
32 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
33 |
.. attribute:: localpart |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
34 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
35 |
The local-part of the address *local-part@domain* |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
36 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
37 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
38 |
.. attribute:: domainname |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
39 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
40 |
The domain part of the address *local-part@domain* |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
41 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
42 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
43 |
Examples |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
44 |
-------- |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
45 |
|
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
46 |
>>> from VirtualMailManager.EmailAddress import EmailAddress |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
47 |
>>> john = EmailAddress('john.doe@example.com') |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
48 |
>>> john.localpart |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
49 |
'john.doe' |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
50 |
>>> john.domainname |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
51 |
'example.com' |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
52 |
>>> jane = EmailAddress('jane.doe@example.com') |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
53 |
>>> jane != john |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
54 |
True |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
55 |
>>> EmailAddress('info@xn--pypal-4ve.tld') == EmailAddress(u'info@pŠ°ypal.tld') |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
56 |
True |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
57 |
>>> jane |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
58 |
EmailAddress('jane.doe@example.com') |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
59 |
>>> print john |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
60 |
john.doe@example.com |
77ac6f572855
doc: extended documentation.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
61 |
>>> |