From 88f40ac0add14cc9e7c106c5e2e9ec3d6f73df6e Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Sat, 17 Jun 2017 03:33:38 +0000 Subject: Provide a better way to avoid instantiating some components --- src/mailman/app/commands.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/mailman/app/commands.py') diff --git a/src/mailman/app/commands.py b/src/mailman/app/commands.py index 9983a25e5..7cf3bc4c5 100644 --- a/src/mailman/app/commands.py +++ b/src/mailman/app/commands.py @@ -19,18 +19,11 @@ from mailman.config import config from mailman.interfaces.command import IEmailCommand -from mailman.utilities.modules import find_components +from mailman.utilities.modules import add_components from public import public -from zope.interface.verify import verifyObject @public def initialize(): """Initialize the email commands.""" - for command_class in find_components('mailman.commands', IEmailCommand): - command = command_class() - verifyObject(IEmailCommand, command) - assert command_class.name not in config.commands, ( - 'Duplicate email command "{}" found in {}'.format( - command_class.name, command_class.__module__)) - config.commands[command_class.name] = command_class() + add_components('mailman.commands', IEmailCommand, config.commands) -- cgit v1.2.3-70-g09d2