summaryrefslogtreecommitdiff
path: root/src/mailman/commands/docs/import.rst
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/commands/docs/import.rst')
-rw-r--r--src/mailman/commands/docs/import.rst56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/mailman/commands/docs/import.rst b/src/mailman/commands/docs/import.rst
new file mode 100644
index 000000000..34521026d
--- /dev/null
+++ b/src/mailman/commands/docs/import.rst
@@ -0,0 +1,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.txt
+
+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.real_name
+ Import
+
+ >>> command.process(FakeArgs)
+ >>> print mlist.real_name
+ Test