summaryrefslogtreecommitdiff
path: root/src/mailman/commands/docs/create.rst
diff options
context:
space:
mode:
authorBarry Warsaw2017-07-22 03:02:06 +0000
committerBarry Warsaw2017-07-22 03:02:06 +0000
commit02826321d0430d7ffc1f674eeff4221941689ef7 (patch)
tree1a8e56dff0eab71e58e5fc9ecc5f3c614d7edca7 /src/mailman/commands/docs/create.rst
parentf54c045519300f6f70947d1114f46c2b8ae0d368 (diff)
parentf00b94f18e1d82d1488cbcee6053f03423bc2f49 (diff)
downloadmailman-02826321d0430d7ffc1f674eeff4221941689ef7.tar.gz
mailman-02826321d0430d7ffc1f674eeff4221941689ef7.tar.zst
mailman-02826321d0430d7ffc1f674eeff4221941689ef7.zip
Diffstat (limited to 'src/mailman/commands/docs/create.rst')
-rw-r--r--src/mailman/commands/docs/create.rst131
1 files changed, 48 insertions, 83 deletions
diff --git a/src/mailman/commands/docs/create.rst b/src/mailman/commands/docs/create.rst
index 12e3a1c95..c80ff7a3d 100644
--- a/src/mailman/commands/docs/create.rst
+++ b/src/mailman/commands/docs/create.rst
@@ -4,34 +4,19 @@ Command line list creation
A system administrator can create mailing lists by the command line.
- >>> class FakeArgs:
- ... language = None
- ... owners = []
- ... quiet = False
- ... domain = True
- ... listname = None
- ... notify = False
+ >>> command = cli('mailman.commands.cli_lists.create')
-You cannot create a mailing list in an unknown domain.
+You can prevent creation of a mailing list in an unknown domain.
- >>> from mailman.commands.cli_lists import Create
- >>> command = Create()
-
- >>> class FakeParser:
- ... def error(self, message):
- ... print(message)
- >>> command.parser = FakeParser()
-
- >>> FakeArgs.domain = False
- >>> FakeArgs.listname = ['test@example.xx']
- >>> command.process(FakeArgs)
- Undefined domain: example.xx
+ >>> command('mailman create --no-domain ant@example.xx')
+ Usage: create [OPTIONS] LISTNAME
+ <BLANKLINE>
+ Error: Undefined domain: example.xx
By default, Mailman will create the domain if it doesn't exist.
- >>> FakeArgs.domain = True
- >>> command.process(FakeArgs)
- Created mailing list: test@example.xx
+ >>> command('mailman create ant@example.xx')
+ Created mailing list: ant@example.xx
Now both the domain and the mailing list exist in the database.
::
@@ -39,36 +24,20 @@ Now both the domain and the mailing list exist in the database.
>>> from mailman.interfaces.listmanager import IListManager
>>> from zope.component import getUtility
>>> list_manager = getUtility(IListManager)
- >>> list_manager.get('test@example.xx')
- <mailing list "test@example.xx" at ...>
+ >>> list_manager.get('ant@example.xx')
+ <mailing list "ant@example.xx" at ...>
>>> from mailman.interfaces.domain import IDomainManager
>>> getUtility(IDomainManager).get('example.xx')
<Domain example.xx>
-You can prevent the creation of the domain in existing domains by using the
-``-D`` or ``--no-domain`` flag. Although the ``--no-domain`` flag is not
-required when domain already exists it can be used to force an error when
-domain doesn't exist.
-
- >>> FakeArgs.domain = False
- >>> FakeArgs.listname = ['test1@example.com']
- >>> command.process(FakeArgs)
- Created mailing list: test1@example.com
-
- >>> list_manager.get('test1@example.com')
- <mailing list "test1@example.com" at ...>
-
The command can also operate quietly.
::
- >>> FakeArgs.quiet = True
- >>> FakeArgs.listname = ['test2@example.com']
- >>> command.process(FakeArgs)
-
- >>> mlist = list_manager.get('test2@example.com')
+ >>> command('mailman create --quiet bee@example.com')
+ >>> mlist = list_manager.get('bee@example.com')
>>> mlist
- <mailing list "test2@example.com" at ...>
+ <mailing list "bee@example.com" at ...>
Setting the owner
@@ -83,32 +52,29 @@ But you can specify an owner address on the command line when you create the
mailing list.
::
- >>> FakeArgs.quiet = False
- >>> FakeArgs.listname = ['test4@example.com']
- >>> FakeArgs.owners = ['foo@example.org']
- >>> command.process(FakeArgs)
- Created mailing list: test4@example.com
+ >>> command('mailman create --owner anne@example.com cat@example.com')
+ Created mailing list: cat@example.com
- >>> mlist = list_manager.get('test4@example.com')
+ >>> mlist = list_manager.get('cat@example.com')
>>> dump_list(repr(address) for address in mlist.owners.addresses)
- <Address: foo@example.org [not verified] at ...>
+ <Address: anne@example.com [not verified] at ...>
You can even specify more than one address for the owners.
::
- >>> FakeArgs.owners = ['foo@example.net',
- ... 'bar@example.net',
- ... 'baz@example.net']
- >>> FakeArgs.listname = ['test5@example.com']
- >>> command.process(FakeArgs)
- Created mailing list: test5@example.com
+ >>> command('mailman create '
+ ... '--owner anne@example.com '
+ ... '--owner bart@example.com '
+ ... '--owner cate@example.com '
+ ... 'dog@example.com')
+ Created mailing list: dog@example.com
- >>> mlist = list_manager.get('test5@example.com')
+ >>> mlist = list_manager.get('dog@example.com')
>>> from operator import attrgetter
>>> dump_list(repr(address) for address in mlist.owners.addresses)
- <Address: bar@example.net [not verified] at ...>
- <Address: baz@example.net [not verified] at ...>
- <Address: foo@example.net [not verified] at ...>
+ <Address: anne@example.com [not verified] at ...>
+ <Address: bart@example.com [not verified] at ...>
+ <Address: cate@example.com [not verified] at ...>
Setting the language
@@ -118,25 +84,21 @@ You can set the default language for the new mailing list when you create it.
The language must be known to Mailman.
::
- >>> FakeArgs.listname = ['test3@example.com']
- >>> FakeArgs.language = 'ee'
- >>> command.process(FakeArgs)
- Invalid language code: ee
+ >>> command('mailman create --language xx ewe@example.com')
+ Usage: create [OPTIONS] LISTNAME
+ <BLANKLINE>
+ Error: Invalid language code: xx
>>> from mailman.interfaces.languages import ILanguageManager
- >>> getUtility(ILanguageManager).add('ee', 'iso-8859-1', 'Freedonian')
- <Language [ee] Freedonian>
+ >>> getUtility(ILanguageManager).add('xx', 'iso-8859-1', 'Freedonian')
+ <Language [xx] Freedonian>
- >>> FakeArgs.quiet = False
- >>> FakeArgs.listname = ['test3@example.com']
- >>> FakeArgs.language = 'fr'
- >>> command.process(FakeArgs)
- Created mailing list: test3@example.com
+ >>> command('mailman create --language xx ewe@example.com')
+ Created mailing list: ewe@example.com
- >>> mlist = list_manager.get('test3@example.com')
+ >>> mlist = list_manager.get('ewe@example.com')
>>> print(mlist.preferred_language)
- <Language [fr] French>
- >>> FakeArgs.language = None
+ <Language [xx] Freedonian>
Notifications
@@ -144,10 +106,13 @@ Notifications
When told to, Mailman will notify the list owners of their new mailing list.
- >>> FakeArgs.listname = ['test6@example.com']
- >>> FakeArgs.notify = True
- >>> command.process(FakeArgs)
- Created mailing list: test6@example.com
+ >>> command('mailman create '
+ ... '--notify '
+ ... '--owner anne@example.com '
+ ... '--owner bart@example.com '
+ ... '--owner cate@example.com '
+ ... 'fly@example.com')
+ Created mailing list: fly@example.com
The notification message is in the virgin queue.
::
@@ -161,19 +126,19 @@ The notification message is in the virgin queue.
... print(message.msg.as_string())
MIME-Version: 1.0
...
- Subject: Your new mailing list: test6@example.com
+ Subject: Your new mailing list: fly@example.com
From: noreply@example.com
- To: foo@example.net, bar@example.net, baz@example.net
+ To: anne@example.com, bart@example.com, cate@example.com
...
<BLANKLINE>
- The mailing list 'test6@example.com' has just been created for you.
+ The mailing list 'fly@example.com' has just been created for you.
The following is some basic information about your mailing list.
<BLANKLINE>
There is an email-based interface for users (not administrators) of
your list; you can get info about using it by sending a message with
just the word 'help' as subject or in the body, to:
<BLANKLINE>
- test6-request@example.com
+ fly-request@example.com
<BLANKLINE>
Please address all questions to noreply@example.com.
<BLANKLINE>