diff options
| author | Barry Warsaw | 2012-06-03 13:21:38 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2012-06-03 13:21:38 -0400 |
| commit | e1aa901fbdcc6d7fbb495a1d9ca1a5079008164a (patch) | |
| tree | 9146fed874216bfb88707848568d7598ec2e8522 /src/mailman/commands/cli_import.py | |
| parent | 847409ba333375bd9c168e28f15748e58970404f (diff) | |
| parent | 3c8a07fc76176a8ea89ee6b73aef571d0b2c81ed (diff) | |
| download | mailman-e1aa901fbdcc6d7fbb495a1d9ca1a5079008164a.tar.gz mailman-e1aa901fbdcc6d7fbb495a1d9ca1a5079008164a.tar.zst mailman-e1aa901fbdcc6d7fbb495a1d9ca1a5079008164a.zip | |
Diffstat (limited to 'src/mailman/commands/cli_import.py')
| -rw-r--r-- | src/mailman/commands/cli_import.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/mailman/commands/cli_import.py b/src/mailman/commands/cli_import.py index b703f3ffd..f6c016585 100644 --- a/src/mailman/commands/cli_import.py +++ b/src/mailman/commands/cli_import.py @@ -17,7 +17,7 @@ """Importing list data into Mailman 3.""" -from __future__ import absolute_import, unicode_literals +from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ @@ -29,21 +29,20 @@ import sys import cPickle from zope.component import getUtility -from zope.interface import implements +from zope.interface import implementer -from mailman.config import config from mailman.core.i18n import _ +from mailman.database.transaction import transactional from mailman.interfaces.command import ICLISubCommand from mailman.interfaces.listmanager import IListManager from mailman.utilities.importer import import_config_pck +@implementer(ICLISubCommand) class Import21: """Import Mailman 2.1 list data.""" - implements(ICLISubCommand) - name = 'import21' def add(self, parser, command_parser): @@ -59,6 +58,7 @@ class Import21: 'pickle_file', metavar='FILENAME', nargs=1, help=_('The path to the config.pck file to import.')) + @transactional def process(self, args): """See `ICLISubCommand`.""" # Could be None or sequence of length 0. @@ -90,10 +90,7 @@ class Import21: return else: if not isinstance(config_dict, dict): - print >> sys.stderr, _( - 'Ignoring non-dictionary: {0!r}').format( - config_dict) + print(_('Ignoring non-dictionary: {0!r}').format( + config_dict), file=sys.stderr) continue import_config_pck(mlist, config_dict) - # Commit the changes to the database. - config.db.commit() |
