blob: 86a31d6ff7c3b84e2ebda4dca607058949ebcf4c (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
===================
Importing list data
===================
If you have the config.pck file for a version 2.1 mailing list, you can import
that into an existing mailing list in Mailman 3.0.
::
>>> from mailman.commands.cli_import import Import21
>>> command = Import21()
>>> class FakeArgs:
... listname = None
... pickle_file = None
>>> class FakeParser:
... def error(self, message):
... print(message)
>>> command.parser = FakeParser()
You must specify the mailing list you are importing into, and it must exist.
::
>>> command.process(FakeArgs)
List name is required
>>> FakeArgs.listname = ['import@example.com']
>>> command.process(FakeArgs)
No such list: import@example.com
When the mailing list exists, you must specify a real pickle file to import
from.
::
>>> mlist = create_list('import@example.com')
>>> command.process(FakeArgs)
config.pck file is required
>>> FakeArgs.pickle_file = [__file__]
>>> command.process(FakeArgs)
Not a Mailman 2.1 configuration file: .../import.rst
Now we can import the test pickle file. As a simple illustration of the
import, the mailing list's 'real name' has changed.
::
>>> from pkg_resources import resource_filename
>>> FakeArgs.pickle_file = [
... resource_filename('mailman.testing', 'config.pck')]
>>> print(mlist.display_name)
Import
>>> command.process(FakeArgs)
>>> print(mlist.display_name)
Test
|