From 3ffddba89c0a0c66280a90b6643d9a66632a5b74 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Sun, 22 Apr 2012 16:40:34 -0400 Subject: - Convert the CLI modules to use print_function. - Use the @transactional decorator. - Use the transaction context manager. --- src/mailman/commands/cli_import.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/mailman/commands/cli_import.py') diff --git a/src/mailman/commands/cli_import.py b/src/mailman/commands/cli_import.py index b703f3ffd..716a8ede1 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__ = [ @@ -31,8 +31,8 @@ import cPickle from zope.component import getUtility from zope.interface import implements -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 @@ -59,6 +59,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 +91,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() -- cgit v1.2.3-70-g09d2