diff options
Diffstat (limited to 'src/mailman/commands')
32 files changed, 97 insertions, 190 deletions
diff --git a/src/mailman/commands/cli_aliases.py b/src/mailman/commands/cli_aliases.py index 7c85ad9e0..2e1dc88ec 100644 --- a/src/mailman/commands/cli_aliases.py +++ b/src/mailman/commands/cli_aliases.py @@ -17,20 +17,16 @@ """Generate Mailman alias files for your MTA.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Aliases', ] -from zope.interface import implementer - from mailman.config import config from mailman.core.i18n import _ from mailman.interfaces.command import ICLISubCommand from mailman.utilities.modules import call_name +from zope.interface import implementer diff --git a/src/mailman/commands/cli_conf.py b/src/mailman/commands/cli_conf.py index 7fe9fce7d..d0b7f7d2f 100644 --- a/src/mailman/commands/cli_conf.py +++ b/src/mailman/commands/cli_conf.py @@ -17,9 +17,6 @@ """Print the mailman configuration.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Conf' ] @@ -29,11 +26,10 @@ import sys from contextlib import closing from lazr.config._config import Section -from zope.interface import implementer - from mailman.config import config from mailman.core.i18n import _ from mailman.interfaces.command import ICLISubCommand +from zope.interface import implementer diff --git a/src/mailman/commands/cli_control.py b/src/mailman/commands/cli_control.py index b0afc1337..de3542106 100644 --- a/src/mailman/commands/cli_control.py +++ b/src/mailman/commands/cli_control.py @@ -15,11 +15,8 @@ # You should have received a copy of the GNU General Public License along with # GNU Mailman. If not, see <http://www.gnu.org/licenses/>. -"""Module stuff.""" +"""Start/stop/reopen/restart commands.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Reopen', 'Restart', @@ -34,12 +31,11 @@ import errno import signal import logging -from zope.interface import implementer - from mailman.bin.master import WatcherState, master_state from mailman.config import config from mailman.core.i18n import _ from mailman.interfaces.command import ICLISubCommand +from zope.interface import implementer qlog = logging.getLogger('mailman.runner') @@ -124,8 +120,8 @@ class Start: # subprocesses to calculate their path to the $VAR_DIR. Before we # chdir() though, calculate the absolute path to the configuration # file. - config_path = (os.path.abspath(args.config) - if args.config else None) + config_path = (config.filename if args.config is None + else os.path.abspath(args.config)) os.environ['MAILMAN_VAR_DIR'] = config.VAR_DIR os.chdir(config.VAR_DIR) # Exec the master watcher. @@ -135,8 +131,9 @@ class Start: ] if args.force: execl_args.append('--force') - if config_path: - execl_args.extend(['-C', config_path]) + # Always pass the config file path to the master projects, so there's + # no confusion about which cfg is being used. + execl_args.extend(['-C', config_path]) qlog.debug('starting: %s', execl_args) os.execl(*execl_args) # We should never get here. diff --git a/src/mailman/commands/cli_help.py b/src/mailman/commands/cli_help.py index ce39eeda5..721c8936e 100644 --- a/src/mailman/commands/cli_help.py +++ b/src/mailman/commands/cli_help.py @@ -17,17 +17,13 @@ """The 'help' subcommand.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Help', ] -from zope.interface import implementer - from mailman.interfaces.command import ICLISubCommand +from zope.interface import implementer diff --git a/src/mailman/commands/cli_import.py b/src/mailman/commands/cli_import.py index 5e25cd4fe..38b6fcef4 100644 --- a/src/mailman/commands/cli_import.py +++ b/src/mailman/commands/cli_import.py @@ -17,25 +17,21 @@ """Importing list data into Mailman 3.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Import21', ] import sys -import cPickle - -from zope.component import getUtility -from zope.interface import implementer 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, Import21Error +from six.moves import cPickle +from zope.component import getUtility +from zope.interface import implementer @@ -78,7 +74,7 @@ class Import21: assert len(args.pickle_file) == 1, ( 'Unexpected positional arguments: %s' % args.pickle_file) filename = args.pickle_file[0] - with open(filename) as fp: + with open(filename, 'rb') as fp: while True: try: config_dict = cPickle.load(fp) diff --git a/src/mailman/commands/cli_info.py b/src/mailman/commands/cli_info.py index 4304e0ddb..6dd938127 100644 --- a/src/mailman/commands/cli_info.py +++ b/src/mailman/commands/cli_info.py @@ -17,9 +17,6 @@ """Information about this Mailman instance.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Info' ] @@ -28,13 +25,12 @@ __all__ = [ import sys from lazr.config import as_boolean -from zope.interface import implementer - from mailman.config import config from mailman.core.i18n import _ from mailman.interfaces.command import ICLISubCommand from mailman.rest.helpers import path_to from mailman.version import MAILMAN_VERSION_FULL +from zope.interface import implementer diff --git a/src/mailman/commands/cli_inject.py b/src/mailman/commands/cli_inject.py index 07ef0ec6c..ad4b53291 100644 --- a/src/mailman/commands/cli_inject.py +++ b/src/mailman/commands/cli_inject.py @@ -17,9 +17,6 @@ """bin/mailman inject""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Inject', ] @@ -27,14 +24,13 @@ __all__ = [ import sys -from zope.component import getUtility -from zope.interface import implementer - from mailman.app.inject import inject_text from mailman.config import config from mailman.core.i18n import _ from mailman.interfaces.command import ICLISubCommand from mailman.interfaces.listmanager import IListManager +from zope.component import getUtility +from zope.interface import implementer @@ -49,7 +45,7 @@ class Inject: self.parser = parser command_parser.add_argument( '-q', '--queue', - type=unicode, help=_(""" + help=_(""" The name of the queue to inject the message to. QUEUE must be one of the directories inside the qfiles directory. If omitted, the incoming queue is used.""")) @@ -59,7 +55,7 @@ class Inject: help=_('Show a list of all available queue names and exit.')) command_parser.add_argument( '-f', '--filename', - type=unicode, help=_(""" + help=_(""" Name of file containing the message to inject. If not given, or '-' (without the quotes) standard input is used.""")) # Required positional argument. diff --git a/src/mailman/commands/cli_lists.py b/src/mailman/commands/cli_lists.py index cf1bd2ead..fac1dcd1d 100644 --- a/src/mailman/commands/cli_lists.py +++ b/src/mailman/commands/cli_lists.py @@ -17,9 +17,6 @@ """The 'lists' subcommand.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Create', 'Lists', @@ -27,9 +24,6 @@ __all__ = [ ] -from zope.component import getUtility -from zope.interface import implementer - from mailman.app.lifecycle import create_list, remove_list from mailman.core.constants import system_preferences from mailman.core.i18n import _ @@ -43,6 +37,8 @@ from mailman.interfaces.domain import ( from mailman.interfaces.languages import ILanguageManager from mailman.interfaces.listmanager import IListManager, ListAlreadyExistsError from mailman.utilities.i18n import make +from zope.component import getUtility +from zope.interface import implementer COMMASPACE = ', ' @@ -135,12 +131,12 @@ class Create: self.parser = parser command_parser.add_argument( '--language', - type=unicode, metavar='CODE', help=_("""\ + metavar='CODE', help=_("""\ Set the list's preferred language to CODE, which must be a registered two letter language code.""")) command_parser.add_argument( '-o', '--owner', - type=unicode, action='append', default=[], + action='append', default=[], dest='owners', metavar='OWNER', help=_("""\ Specify a listowner email address. If the address is not currently registered with Mailman, the address is registered and diff --git a/src/mailman/commands/cli_members.py b/src/mailman/commands/cli_members.py index 291fda3b7..21d78ec54 100644 --- a/src/mailman/commands/cli_members.py +++ b/src/mailman/commands/cli_members.py @@ -17,9 +17,6 @@ """The 'members' subcommand.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Members', ] @@ -29,11 +26,6 @@ import sys import codecs from email.utils import formataddr, parseaddr -from operator import attrgetter -from passlib.utils import generate_password as generate -from zope.component import getUtility -from zope.interface import implementer - from mailman.app.membership import add_member from mailman.config import config from mailman.core.i18n import _ @@ -42,6 +34,10 @@ from mailman.interfaces.command import ICLISubCommand from mailman.interfaces.listmanager import IListManager from mailman.interfaces.member import ( AlreadySubscribedError, DeliveryMode, DeliveryStatus) +from operator import attrgetter +from passlib.utils import generate_password as generate +from zope.component import getUtility +from zope.interface import implementer @@ -197,8 +193,6 @@ class Members: continue # Parse the line and ensure that the values are unicodes. display_name, email = parseaddr(line) - display_name = display_name.decode(fp.encoding) - email = email.decode(fp.encoding) # Give the user a default, user-friendly password. password = generate(int(config.passwords.password_length)) try: diff --git a/src/mailman/commands/cli_qfile.py b/src/mailman/commands/cli_qfile.py index 986898bee..e502deac8 100644 --- a/src/mailman/commands/cli_qfile.py +++ b/src/mailman/commands/cli_qfile.py @@ -17,24 +17,22 @@ """Getting information out of a qfile.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'QFile', ] -import cPickle - -from pprint import PrettyPrinter -from zope.interface import implementer +import six from mailman.core.i18n import _ from mailman.interfaces.command import ICLISubCommand from mailman.utilities.interact import interact +from pprint import PrettyPrinter +from six.moves import cPickle +from zope.interface import implementer +# This is deliberately called 'm' for use with --interactive. m = [] @@ -71,7 +69,7 @@ class QFile: """See `ICLISubCommand`.""" printer = PrettyPrinter(indent=4) assert len(args.qfile) == 1, 'Wrong number of positional arguments' - with open(args.qfile[0]) as fp: + with open(args.qfile[0], 'rb') as fp: while True: try: m.append(cPickle.load(fp)) @@ -82,7 +80,7 @@ class QFile: for i, obj in enumerate(m): count = i + 1 print(_('<----- start object $count ----->')) - if isinstance(obj, basestring): + if isinstance(obj, six.string_types): print(obj) else: printer.pprint(obj) diff --git a/src/mailman/commands/cli_status.py b/src/mailman/commands/cli_status.py index 207b44e04..2bef9d73c 100644 --- a/src/mailman/commands/cli_status.py +++ b/src/mailman/commands/cli_status.py @@ -17,9 +17,6 @@ """bin/mailman status.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Status', ] @@ -27,11 +24,10 @@ __all__ = [ import socket -from zope.interface import implementer - from mailman.bin.master import WatcherState, master_state from mailman.core.i18n import _ from mailman.interfaces.command import ICLISubCommand +from zope.interface import implementer diff --git a/src/mailman/commands/cli_unshunt.py b/src/mailman/commands/cli_unshunt.py index 77196565b..7cfa9e4ed 100644 --- a/src/mailman/commands/cli_unshunt.py +++ b/src/mailman/commands/cli_unshunt.py @@ -17,9 +17,6 @@ """The 'unshunt' command.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Unshunt', ] @@ -27,11 +24,10 @@ __all__ = [ import sys -from zope.interface import implementer - from mailman.config import config from mailman.core.i18n import _ from mailman.interfaces.command import ICLISubCommand +from zope.interface import implementer @@ -62,7 +58,7 @@ class Unshunt: which_queue = msgdata.get('whichq', 'in') if not args.discard: config.switchboards[which_queue].enqueue(msg, msgdata) - except Exception as error: + except Exception: print(_('Cannot unshunt message $filebase, skipping:\n$error'), file=sys.stderr) else: diff --git a/src/mailman/commands/cli_version.py b/src/mailman/commands/cli_version.py index 86ce9ab68..bc0f34a34 100644 --- a/src/mailman/commands/cli_version.py +++ b/src/mailman/commands/cli_version.py @@ -17,18 +17,14 @@ """The Mailman version.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Version', ] -from zope.interface import implementer - from mailman.interfaces.command import ICLISubCommand from mailman.version import MAILMAN_VERSION_FULL +from zope.interface import implementer diff --git a/src/mailman/commands/cli_withlist.py b/src/mailman/commands/cli_withlist.py index fc2363816..7cf8c0451 100644 --- a/src/mailman/commands/cli_withlist.py +++ b/src/mailman/commands/cli_withlist.py @@ -17,9 +17,6 @@ """bin/mailman withlist""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Shell', 'Withlist', @@ -30,15 +27,15 @@ import re import sys from lazr.config import as_boolean -from zope.component import getUtility -from zope.interface import implementer - from mailman.config import config from mailman.core.i18n import _ from mailman.interfaces.command import ICLISubCommand from mailman.interfaces.listmanager import IListManager from mailman.utilities.interact import DEFAULT_BANNER, interact from mailman.utilities.modules import call_name +from zope.component import getUtility +from zope.interface import implementer + # Global holding onto the open mailing list. m = None diff --git a/src/mailman/commands/docs/echo.rst b/src/mailman/commands/docs/echo.rst index 32399ebfc..6412a4afe 100644 --- a/src/mailman/commands/docs/echo.rst +++ b/src/mailman/commands/docs/echo.rst @@ -24,7 +24,7 @@ The original message is ignored, but the results receive the echoed command. >>> from mailman.email.message import Message >>> print(command.process(mlist, Message(), {}, ('foo', 'bar'), results)) ContinueProcessing.yes - >>> print(unicode(results)) + >>> print(str(results)) The results of your email command are provided below. <BLANKLINE> echo foo bar diff --git a/src/mailman/commands/docs/help.rst b/src/mailman/commands/docs/help.rst index bbd6c8c09..5330a0b79 100644 --- a/src/mailman/commands/docs/help.rst +++ b/src/mailman/commands/docs/help.rst @@ -25,7 +25,7 @@ short description of each of them. >>> from mailman.email.message import Message >>> print(help.process(mlist, Message(), {}, (), results)) ContinueProcessing.yes - >>> print(unicode(results)) + >>> print(results) The results of your email command are provided below. <BLANKLINE> confirm - Confirm a subscription request. @@ -44,19 +44,19 @@ With an argument, you can get more detailed help about a specific command. >>> results = Results() >>> print(help.process(mlist, Message(), {}, ('help',), results)) ContinueProcessing.yes - >>> print(unicode(results)) + >>> print(results) The results of your email command are provided below. <BLANKLINE> help [command] Get help about available email commands. <BLANKLINE> - + Some commands have even more detailed help. >>> results = Results() >>> print(help.process(mlist, Message(), {}, ('join',), results)) ContinueProcessing.yes - >>> print(unicode(results)) + >>> print(results) The results of your email command are provided below. <BLANKLINE> join [digest=<no|mime|plain>] diff --git a/src/mailman/commands/docs/info.rst b/src/mailman/commands/docs/info.rst index 8bc7579e6..6ce223403 100644 --- a/src/mailman/commands/docs/info.rst +++ b/src/mailman/commands/docs/info.rst @@ -62,20 +62,21 @@ definition. Python ... ... File system paths: - ARCHIVE_DIR = /var/lib/mailman/archives - BIN_DIR = /sbin - DATA_DIR = /var/lib/mailman/data - ETC_DIR = /etc - EXT_DIR = /etc/mailman.d - LIST_DATA_DIR = /var/lib/mailman/lists - LOCK_DIR = /var/lock/mailman - LOCK_FILE = /var/lock/mailman/master.lck - LOG_DIR = /var/log/mailman - MESSAGES_DIR = /var/lib/mailman/messages - PID_FILE = /var/run/mailman/master.pid - QUEUE_DIR = /var/spool/mailman - TEMPLATE_DIR = .../mailman/templates - VAR_DIR = /var/lib/mailman + ARCHIVE_DIR = /var/lib/mailman/archives + BIN_DIR = /sbin + CFG_FILE = .../test.cfg + DATA_DIR = /var/lib/mailman/data + ETC_DIR = /etc + EXT_DIR = /etc/mailman.d + LIST_DATA_DIR = /var/lib/mailman/lists + LOCK_DIR = /var/lock/mailman + LOCK_FILE = /var/lock/mailman/master.lck + LOG_DIR = /var/log/mailman + MESSAGES_DIR = /var/lib/mailman/messages + PID_FILE = /var/run/mailman/master.pid + QUEUE_DIR = /var/spool/mailman + TEMPLATE_DIR = .../mailman/templates + VAR_DIR = /var/lib/mailman .. _`Filesystem Hierarchy Standard`: http://www.pathname.com/fhs/ diff --git a/src/mailman/commands/docs/inject.rst b/src/mailman/commands/docs/inject.rst index 63e7b0366..de295b8f6 100644 --- a/src/mailman/commands/docs/inject.rst +++ b/src/mailman/commands/docs/inject.rst @@ -94,7 +94,7 @@ By default, the incoming queue is used. >>> dump_msgdata(items[0].msgdata) _parsemsg : False - listname : test@example.com + listid : test.example.com original_size: 203 version : 3 @@ -122,7 +122,7 @@ But a different queue can be specified on the command line. >>> dump_msgdata(items[0].msgdata) _parsemsg : False - listname : test@example.com + listid : test.example.com original_size: 203 version : 3 @@ -133,7 +133,7 @@ Standard input The message text can also be provided on standard input. :: - >>> from StringIO import StringIO + >>> from six import StringIO # Remember: we've got unicode literals turned on. >>> standard_in = StringIO(str("""\ @@ -167,7 +167,7 @@ The message text can also be provided on standard input. >>> dump_msgdata(items[0].msgdata) _parsemsg : False - listname : test@example.com + listid : test.example.com original_size: 211 version : 3 @@ -195,7 +195,7 @@ injected. _parsemsg : False bar : two foo : one - listname : test@example.com + listid : test.example.com original_size: 203 version : 3 diff --git a/src/mailman/commands/docs/members.rst b/src/mailman/commands/docs/members.rst index 7b99e92f9..28f238f31 100644 --- a/src/mailman/commands/docs/members.rst +++ b/src/mailman/commands/docs/members.rst @@ -229,15 +229,14 @@ You can also specify ``-`` as the filename, in which case the addresses are taken from standard input. :: - >>> from StringIO import StringIO + >>> from six import StringIO >>> fp = StringIO() - >>> fp.encoding = 'us-ascii' >>> for address in ('dperson@example.com', ... 'Elly Person <eperson@example.com>', ... 'fperson@example.com (Fred Person)', ... ): ... print(address, file=fp) - >>> fp.seek(0) + >>> filepos = fp.seek(0) >>> import sys >>> sys.stdin = fp diff --git a/src/mailman/commands/docs/membership.rst b/src/mailman/commands/docs/membership.rst index aa3ab97e6..a260e930a 100644 --- a/src/mailman/commands/docs/membership.rst +++ b/src/mailman/commands/docs/membership.rst @@ -45,7 +45,7 @@ If that's missing though, then an error is returned. >>> from mailman.email.message import Message >>> print(join.process(mlist, Message(), {}, (), results)) ContinueProcessing.no - >>> print(unicode(results)) + >>> print(results) The results of your email command are provided below. <BLANKLINE> join: No valid address found to subscribe @@ -60,7 +60,7 @@ The ``subscribe`` command is an alias. >>> results = Results() >>> print(subscribe.process(mlist, Message(), {}, (), results)) ContinueProcessing.no - >>> print(unicode(results)) + >>> print(results) The results of your email command are provided below. <BLANKLINE> subscribe: No valid address found to subscribe @@ -79,7 +79,7 @@ When the message has a From field, that address will be subscribed. >>> results = Results() >>> print(join.process(mlist, msg, {}, (), results)) ContinueProcessing.yes - >>> print(unicode(results)) + >>> print(results) The results of your email command are provided below. <BLANKLINE> Confirmation email sent to Anne Person <anne@example.com> @@ -150,7 +150,7 @@ list. >>> results = Results() >>> print(confirm.process(mlist, msg, {}, (token,), results)) ContinueProcessing.yes - >>> print(unicode(results)) + >>> print(results) The results of your email command are provided below. <BLANKLINE> Confirmed @@ -208,7 +208,7 @@ list. >>> results = Results() >>> print(confirm.process(mlist_2, msg, {}, (token,), results)) ContinueProcessing.yes - >>> print(unicode(results)) + >>> print(results) The results of your email command are provided below. <BLANKLINE> Confirmed @@ -241,7 +241,7 @@ is sent a confirmation message for her request. >>> results = Results() >>> print(leave.process(mlist_2, msg, {}, (), results)) ContinueProcessing.yes - >>> print(unicode(results)) + >>> print(results) The results of your email command are provided below. <BLANKLINE> Anne Person <anne@example.com> left baker@example.com @@ -278,7 +278,7 @@ to unsubscribe Anne from the alpha mailing list. >>> print(leave.process(mlist, msg, {}, (), results)) ContinueProcessing.no - >>> print(unicode(results)) + >>> print(results) The results of your email command are provided below. <BLANKLINE> Invalid or unverified email address: anne.person@example.org @@ -299,7 +299,7 @@ unsubscribe her from the list. >>> print(leave.process(mlist, msg, {}, (), results)) ContinueProcessing.yes - >>> print(unicode(results)) + >>> print(results) The results of your email command are provided below. <BLANKLINE> Anne Person <anne.person@example.org> left alpha@example.com @@ -354,7 +354,7 @@ a user of the system. >>> print(confirm.process(mlist, msg, {}, (token,), results)) ContinueProcessing.yes - >>> print(unicode(results)) + >>> print(results) The results of your email command are provided below. <BLANKLINE> Confirmed diff --git a/src/mailman/commands/docs/qfile.rst b/src/mailman/commands/docs/qfile.rst index 8ec0a3952..e097ebf97 100644 --- a/src/mailman/commands/docs/qfile.rst +++ b/src/mailman/commands/docs/qfile.rst @@ -47,7 +47,6 @@ Once we've figured out the file name of the shunted message, we can print it. >>> command.process(FakeArgs) [----- start pickle -----] <----- start object 1 -----> - From nobody ... From: aperson@example.com To: test@example.com Subject: Uh oh @@ -55,11 +54,7 @@ Once we've figured out the file name of the shunted message, we can print it. I borkeded Mailman. <BLANKLINE> <----- start object 2 -----> - { u'_parsemsg': False, - 'bad': u'yes', - 'bar': u'baz', - 'foo': 7, - u'version': 3} + {'_parsemsg': False, 'bad': 'yes', 'bar': 'baz', 'foo': 7, 'version': 3} [----- end pickle -----] Maybe we don't want to print the contents of the file though, in case we want diff --git a/src/mailman/commands/docs/withlist.rst b/src/mailman/commands/docs/withlist.rst index e915eb04c..321b6e68a 100644 --- a/src/mailman/commands/docs/withlist.rst +++ b/src/mailman/commands/docs/withlist.rst @@ -52,10 +52,10 @@ single argument, the mailing list. >>> with open(os.path.join(config.VAR_DIR, 'showme.py'), 'w') as fp: ... print("""\ ... def showme(mailing_list): - ... print "The list's name is", mailing_list.fqdn_listname + ... print("The list's name is", mailing_list.fqdn_listname) ... ... def displayname(mailing_list): - ... print "The list's display name is", mailing_list.display_name + ... print("The list's display name is", mailing_list.display_name) ... """, file=fp) If the name of the function is the same as the module, then you only need to diff --git a/src/mailman/commands/eml_confirm.py b/src/mailman/commands/eml_confirm.py index 0239e0f25..2cef7cbad 100644 --- a/src/mailman/commands/eml_confirm.py +++ b/src/mailman/commands/eml_confirm.py @@ -15,22 +15,18 @@ # You should have received a copy of the GNU General Public License along with # GNU Mailman. If not, see <http://www.gnu.org/licenses/>. -"""Module stuff.""" +"""The 'confirm' email command.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Confirm', ] -from zope.component import getUtility -from zope.interface import implementer - from mailman.core.i18n import _ from mailman.interfaces.command import ContinueProcessing, IEmailCommand from mailman.interfaces.registrar import IRegistrar +from zope.component import getUtility +from zope.interface import implementer diff --git a/src/mailman/commands/eml_echo.py b/src/mailman/commands/eml_echo.py index eb476dc7d..2bd55edbc 100644 --- a/src/mailman/commands/eml_echo.py +++ b/src/mailman/commands/eml_echo.py @@ -17,18 +17,14 @@ """The email command 'echo'.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Echo', ] -from zope.interface import implementer - from mailman.core.i18n import _ from mailman.interfaces.command import ContinueProcessing, IEmailCommand +from zope.interface import implementer SPACE = ' ' diff --git a/src/mailman/commands/eml_end.py b/src/mailman/commands/eml_end.py index 447d4066b..d25c19fcb 100644 --- a/src/mailman/commands/eml_end.py +++ b/src/mailman/commands/eml_end.py @@ -17,19 +17,15 @@ """The email commands 'end' and 'stop'.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'End', 'Stop', ] -from zope.interface import implementer - from mailman.core.i18n import _ from mailman.interfaces.command import ContinueProcessing, IEmailCommand +from zope.interface import implementer diff --git a/src/mailman/commands/eml_help.py b/src/mailman/commands/eml_help.py index 139d484fb..8b93b272a 100644 --- a/src/mailman/commands/eml_help.py +++ b/src/mailman/commands/eml_help.py @@ -17,20 +17,16 @@ """The email command 'help'.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Help', ] -from zope.interface import implementer - from mailman.config import config from mailman.core.i18n import _ from mailman.interfaces.command import ContinueProcessing, IEmailCommand from mailman.utilities.string import wrap +from zope.interface import implementer SPACE = ' ' diff --git a/src/mailman/commands/eml_membership.py b/src/mailman/commands/eml_membership.py index c56b14041..e6a6825ed 100644 --- a/src/mailman/commands/eml_membership.py +++ b/src/mailman/commands/eml_membership.py @@ -17,9 +17,6 @@ """The email commands 'join' and 'subscribe'.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'Join', 'Subscribe', @@ -29,15 +26,14 @@ __all__ = [ from email.utils import formataddr, parseaddr -from zope.component import getUtility -from zope.interface import implementer - from mailman.core.i18n import _ from mailman.interfaces.command import ContinueProcessing, IEmailCommand from mailman.interfaces.member import DeliveryMode, MemberRole from mailman.interfaces.registrar import IRegistrar from mailman.interfaces.subscriptions import ISubscriptionService from mailman.interfaces.usermanager import IUserManager +from zope.component import getUtility +from zope.interface import implementer @@ -182,6 +178,7 @@ You may be asked to confirm your request.""") return ContinueProcessing.yes + class Unsubscribe(Leave): """The email 'unsubscribe' command (an alias for 'leave').""" diff --git a/src/mailman/commands/tests/test_conf.py b/src/mailman/commands/tests/test_conf.py index 12ed5c537..07036df3a 100644 --- a/src/mailman/commands/tests/test_conf.py +++ b/src/mailman/commands/tests/test_conf.py @@ -17,9 +17,6 @@ """Test the conf subcommand.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'TestConf', ] @@ -31,9 +28,9 @@ import mock import tempfile import unittest -from StringIO import StringIO from mailman.commands.cli_conf import Conf from mailman.testing.layers import ConfigLayer +from six import StringIO diff --git a/src/mailman/commands/tests/test_confirm.py b/src/mailman/commands/tests/test_confirm.py index 19a9068bc..f067a2a0a 100644 --- a/src/mailman/commands/tests/test_confirm.py +++ b/src/mailman/commands/tests/test_confirm.py @@ -17,9 +17,6 @@ """Test the `confirm` command.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'TestConfirm', ] @@ -27,8 +24,6 @@ __all__ = [ import unittest -from zope.component import getUtility - from mailman.app.lifecycle import create_list from mailman.commands.eml_confirm import Confirm from mailman.email.message import Message @@ -37,6 +32,7 @@ from mailman.interfaces.registrar import IRegistrar from mailman.runners.command import Results from mailman.testing.helpers import get_queue_messages, reset_the_world from mailman.testing.layers import ConfigLayer +from zope.component import getUtility diff --git a/src/mailman/commands/tests/test_control.py b/src/mailman/commands/tests/test_control.py index 0847d86b1..299f0da25 100644 --- a/src/mailman/commands/tests/test_control.py +++ b/src/mailman/commands/tests/test_control.py @@ -17,9 +17,6 @@ """Test some additional corner cases for starting/stopping.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'TestStart', 'find_master', @@ -37,11 +34,11 @@ import socket import unittest from datetime import timedelta, datetime - from mailman.commands.cli_control import Start, kill_watcher from mailman.config import config from mailman.testing.layers import ConfigLayer + SEP = '|' diff --git a/src/mailman/commands/tests/test_create.py b/src/mailman/commands/tests/test_create.py index c2dffb929..47808c997 100644 --- a/src/mailman/commands/tests/test_create.py +++ b/src/mailman/commands/tests/test_create.py @@ -17,9 +17,6 @@ """Test `bin/mailman create`.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ 'TestCreate', ] diff --git a/src/mailman/commands/tests/test_help.py b/src/mailman/commands/tests/test_help.py index 3c7d1ae9f..b2de0297d 100644 --- a/src/mailman/commands/tests/test_help.py +++ b/src/mailman/commands/tests/test_help.py @@ -17,10 +17,8 @@ """Additional tests for the `help` email command.""" -from __future__ import absolute_import, print_function, unicode_literals - -__metaclass__ = type __all__ = [ + 'TestHelp', ] @@ -47,11 +45,11 @@ class TestHelp(unittest.TestCase): def test_too_many_arguments(self): # Error message when too many help arguments are given. results = Results() - status = self._help.process(self._mlist, Message(), {}, + status = self._help.process(self._mlist, Message(), {}, ('more', 'than', 'one'), results) self.assertEqual(status, ContinueProcessing.no) - self.assertEqual(unicode(results), """\ + self.assertEqual(str(results), """\ The results of your email command are provided below. help: too many arguments: more than one @@ -60,10 +58,10 @@ help: too many arguments: more than one def test_no_such_command(self): # Error message when asking for help on an existent command. results = Results() - status = self._help.process(self._mlist, Message(), {}, + status = self._help.process(self._mlist, Message(), {}, ('doesnotexist',), results) self.assertEqual(status, ContinueProcessing.no) - self.assertEqual(unicode(results), """\ + self.assertEqual(str(results), """\ The results of your email command are provided below. help: no such command: doesnotexist |
