diff options
Diffstat (limited to 'src/mailman/commands/docs/import.rst')
| -rw-r--r-- | src/mailman/commands/docs/import.rst | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/src/mailman/commands/docs/import.rst b/src/mailman/commands/docs/import.rst index 86a31d6ff..5c5883921 100644 --- a/src/mailman/commands/docs/import.rst +++ b/src/mailman/commands/docs/import.rst @@ -2,55 +2,52 @@ 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. -:: +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() + >>> command = cli('mailman.commands.cli_import.import21') - >>> class FakeArgs: - ... listname = None - ... pickle_file = None +You must specify the mailing list you are importing into, and it must exist. - >>> class FakeParser: - ... def error(self, message): - ... print(message) - >>> command.parser = FakeParser() + >>> command('mailman import21') + Usage: ... [OPTIONS] LISTSPEC PICKLE_FILE + <BLANKLINE> + Error: Missing argument "listspec". -You must specify the mailing list you are importing into, and it must exist. -:: +You must also specify a pickle file to import. - >>> command.process(FakeArgs) - List name is required + >>> command('mailman import21 import@example.com') + Usage: ... [OPTIONS] LISTSPEC PICKLE_FILE + <BLANKLINE> + Error: Missing argument "pickle_file". - >>> FakeArgs.listname = ['import@example.com'] - >>> command.process(FakeArgs) - No such list: import@example.com +Too bad the list doesn't exist. + + >>> from pkg_resources import resource_filename + >>> pickle_file = resource_filename('mailman.testing', 'config.pck') + >>> command('mailman import21 import@example.com ' + pickle_file) + Usage: ... [OPTIONS] LISTSPEC PICKLE_FILE + <BLANKLINE> + Error: 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 + >>> transaction.commit() + >>> command('mailman import21 import@example.com ' + __file__) + Usage: ... [OPTIONS] LISTSPEC PICKLE_FILE + <BLANKLINE> + Error: 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. +import, the mailing list's "real name" will change. :: - >>> from pkg_resources import resource_filename - >>> FakeArgs.pickle_file = [ - ... resource_filename('mailman.testing', 'config.pck')] - >>> print(mlist.display_name) Import - >>> command.process(FakeArgs) + >>> command('mailman import21 import@example.com ' + pickle_file) >>> print(mlist.display_name) Test |
