~jimmy-sigint/mailman/restapi_additional_attributes

« back to all changes in this revision

Viewing changes to src/mailman/model/docs/domains.txt

  • Committer: Barry Warsaw
  • Date: 2010-09-09 02:35:20 UTC
  • Revision ID: barry@list.org-20100909023520-juyyjewh3t0w11pz
Many documentation fixes for better Sphinx output.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Domains
3
3
=======
4
4
 
5
 
    # The test framework starts out with an example domain, so let's delete
 
5
..  # The test framework starts out with an example domain, so let's delete
6
6
    # that first.
7
7
    >>> from mailman.interfaces.domain import IDomainManager
8
8
    >>> from zope.component import getUtility
11
11
    <Domain example.com...>
12
12
 
13
13
Domains are how Mailman interacts with email host names and web host names.
 
14
::
14
15
 
15
16
    >>> from operator import attrgetter
16
17
    >>> def show_domains():
52
53
            contact_address: postmaster@example.com>
53
54
 
54
55
Domains can have explicit descriptions and contact addresses.
 
56
::
55
57
 
56
58
    >>> manager.add(
57
59
    ...     'example.net',
70
72
            contact_address: postmaster@example.com>
71
73
 
72
74
In the global domain manager, domains are indexed by their email host name.
 
75
::
73
76
 
74
77
    >>> for domain in sorted(manager, key=attrgetter('email_host')):
75
78
    ...     print domain.email_host
87
90
    KeyError: u'doesnotexist.com'
88
91
 
89
92
As with a dictionary, you can also get the domain.  If the domain does not
90
 
exist, None or a default is returned.
 
93
exist, ``None`` or a default is returned.
 
94
::
91
95
 
92
96
    >>> print manager.get('example.net')
93
97
    <Domain example.net, The example domain,