~barry/mailman/events-and-web

« back to all changes in this revision

Viewing changes to src/mailman/commands/docs/create.rst

  • Committer: klm
  • Date: 1998-01-07 21:21:35 UTC
  • Revision ID: vcs-imports@canonical.com-19980107212135-sv0y521ps0xye37r
Initial revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
==========================
2
 
Command line list creation
3
 
==========================
4
 
 
5
 
A system administrator can create mailing lists by the command line.
6
 
 
7
 
    >>> class FakeArgs:
8
 
    ...     language = None
9
 
    ...     owners = []
10
 
    ...     quiet = False
11
 
    ...     domain = None
12
 
    ...     listname = None
13
 
    ...     notify = False
14
 
 
15
 
You cannot create a mailing list in an unknown domain.
16
 
 
17
 
    >>> from mailman.commands.cli_lists import Create
18
 
    >>> command = Create()
19
 
 
20
 
    >>> class FakeParser:
21
 
    ...     def error(self, message):
22
 
    ...         print message
23
 
    >>> command.parser = FakeParser()
24
 
 
25
 
    >>> FakeArgs.listname = ['test@example.xx']
26
 
    >>> command.process(FakeArgs)
27
 
    Undefined domain: example.xx
28
 
 
29
 
The ``-d`` or ``--domain`` option is used to tell Mailman to auto-register the
30
 
domain.  Both the mailing list and domain will be created.
31
 
 
32
 
    >>> FakeArgs.domain = True
33
 
    >>> command.process(FakeArgs)
34
 
    Created mailing list: test@example.xx
35
 
 
36
 
Now both the domain and the mailing list exist in the database.
37
 
::
38
 
 
39
 
    >>> from mailman.interfaces.listmanager import IListManager
40
 
    >>> from zope.component import getUtility
41
 
    >>> list_manager = getUtility(IListManager)
42
 
    >>> list_manager.get('test@example.xx')
43
 
    <mailing list "test@example.xx" at ...>
44
 
 
45
 
    >>> from mailman.interfaces.domain import IDomainManager
46
 
    >>> getUtility(IDomainManager).get('example.xx')
47
 
    <Domain example.xx, base_url: http://example.xx,
48
 
            contact_address: postmaster@example.xx>
49
 
 
50
 
You can also create mailing lists in existing domains without the
51
 
auto-creation flag.
52
 
::
53
 
 
54
 
    >>> FakeArgs.domain = False
55
 
    >>> FakeArgs.listname = ['test1@example.com']
56
 
    >>> command.process(FakeArgs)
57
 
    Created mailing list: test1@example.com
58
 
 
59
 
    >>> list_manager.get('test1@example.com')
60
 
    <mailing list "test1@example.com" at ...>
61
 
 
62
 
The command can also operate quietly.
63
 
::
64
 
 
65
 
    >>> FakeArgs.quiet = True
66
 
    >>> FakeArgs.listname = ['test2@example.com']
67
 
    >>> command.process(FakeArgs)
68
 
 
69
 
    >>> mlist = list_manager.get('test2@example.com')
70
 
    >>> mlist
71
 
    <mailing list "test2@example.com" at ...>
72
 
 
73
 
 
74
 
Setting the owner
75
 
=================
76
 
 
77
 
By default, no list owners are specified.
78
 
 
79
 
    >>> dump_list(mlist.owners.addresses)
80
 
    *Empty*
81
 
 
82
 
But you can specify an owner address on the command line when you create the
83
 
mailing list.
84
 
::
85
 
 
86
 
    >>> FakeArgs.quiet = False
87
 
    >>> FakeArgs.listname = ['test4@example.com']
88
 
    >>> FakeArgs.owners = ['foo@example.org']
89
 
    >>> command.process(FakeArgs)
90
 
    Created mailing list: test4@example.com
91
 
 
92
 
    >>> mlist = list_manager.get('test4@example.com')
93
 
    >>> dump_list(repr(address) for address in mlist.owners.addresses)
94
 
    <Address: foo@example.org [not verified] at ...>
95
 
 
96
 
You can even specify more than one address for the owners.
97
 
::
98
 
 
99
 
    >>> FakeArgs.owners = ['foo@example.net',
100
 
    ...                    'bar@example.net',
101
 
    ...                    'baz@example.net']
102
 
    >>> FakeArgs.listname = ['test5@example.com']
103
 
    >>> command.process(FakeArgs)
104
 
    Created mailing list: test5@example.com
105
 
 
106
 
    >>> mlist = list_manager.get('test5@example.com')
107
 
    >>> from operator import attrgetter
108
 
    >>> dump_list(repr(address) for address in mlist.owners.addresses)
109
 
    <Address: bar@example.net [not verified] at ...>
110
 
    <Address: baz@example.net [not verified] at ...>
111
 
    <Address: foo@example.net [not verified] at ...>
112
 
 
113
 
 
114
 
Setting the language
115
 
====================
116
 
 
117
 
You can set the default language for the new mailing list when you create it.
118
 
The language must be known to Mailman.
119
 
::
120
 
 
121
 
    >>> FakeArgs.listname = ['test3@example.com']
122
 
    >>> FakeArgs.language = 'ee'
123
 
    >>> command.process(FakeArgs)
124
 
    Invalid language code: ee
125
 
 
126
 
    >>> from mailman.interfaces.languages import ILanguageManager
127
 
    >>> getUtility(ILanguageManager).add('ee', 'iso-8859-1', 'Freedonian')
128
 
    <Language [ee] Freedonian>
129
 
 
130
 
    >>> FakeArgs.quiet = False
131
 
    >>> FakeArgs.listname = ['test3@example.com']
132
 
    >>> FakeArgs.language = 'fr'
133
 
    >>> command.process(FakeArgs)
134
 
    Created mailing list: test3@example.com
135
 
 
136
 
    >>> mlist = list_manager.get('test3@example.com')
137
 
    >>> print mlist.preferred_language
138
 
    <Language [fr] French>
139
 
    >>> FakeArgs.language = None
140
 
 
141
 
 
142
 
Notifications
143
 
=============
144
 
 
145
 
When told to, Mailman will notify the list owners of their new mailing list.
146
 
 
147
 
    >>> FakeArgs.listname = ['test6@example.com']
148
 
    >>> FakeArgs.notify = True
149
 
    >>> command.process(FakeArgs)
150
 
    Created mailing list: test6@example.com
151
 
 
152
 
The notification message is in the virgin queue.
153
 
::
154
 
 
155
 
    >>> from mailman.testing.helpers import get_queue_messages
156
 
    >>> messages = get_queue_messages('virgin')
157
 
    >>> len(messages)
158
 
    1
159
 
 
160
 
    >>> for message in messages:
161
 
    ...     print message.msg.as_string()
162
 
    MIME-Version: 1.0
163
 
    ...
164
 
    Subject: Your new mailing list: test6@example.com
165
 
    From: noreply@example.com
166
 
    To: foo@example.net, bar@example.net, baz@example.net
167
 
    ...
168
 
    <BLANKLINE>
169
 
    The mailing list 'test6@example.com' has just been created for you.
170
 
    The following is some basic information about your mailing list.
171
 
    <BLANKLINE>
172
 
    You can configure your mailing list at the following web page:
173
 
    <BLANKLINE>
174
 
        http://lists.example.com/admin/test6@example.com
175
 
    <BLANKLINE>
176
 
    The web page for users of your mailing list is:
177
 
    <BLANKLINE>
178
 
        http://lists.example.com/listinfo/test6@example.com
179
 
    <BLANKLINE>
180
 
    There is also an email-based interface for users (not administrators)
181
 
    of your list; you can get info about using it by sending a message
182
 
    with just the word 'help' as subject or in the body, to:
183
 
    <BLANKLINE>
184
 
        test6-request@example.com
185
 
    <BLANKLINE>
186
 
    Please address all questions to noreply@example.com.
187
 
    <BLANKLINE>