summaryrefslogtreecommitdiff
path: root/src/mailman/commands/docs/remove.rst
blob: c534741f373c5e82ef7b493af2dd5853ed46ccac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
=========================
Command line list removal
=========================

A system administrator can remove mailing lists by the command line.
::

    >>> create_list('test@example.com')
    <mailing list "test@example.com" at ...>

    >>> from mailman.interfaces.listmanager import IListManager
    >>> from zope.component import getUtility
    >>> list_manager = getUtility(IListManager)
    >>> list_manager.get('test@example.com')
    <mailing list "test@example.com" at ...>

    >>> class FakeArgs:
    ...     quiet = False
    ...     archives = False
    ...     listname = ['test@example.com']
    >>> args = FakeArgs()

    >>> from mailman.commands.cli_lists import Remove
    >>> command = Remove()
    >>> command.process(args)
    Removed list: test@example.com

    >>> print(list_manager.get('test@example.com'))
    None

You can also remove lists quietly.
::

    >>> create_list('test@example.com')
    <mailing list "test@example.com" at ...>

    >>> args.quiet = True
    >>> command.process(args)

    >>> print(list_manager.get('test@example.com'))
    None