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/core/pipelines.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/mailman/core/pipelines.py') diff --git a/src/mailman/core/pipelines.py b/src/mailman/core/pipelines.py index 07780dfeb..15e23a022 100644 --- a/src/mailman/core/pipelines.py +++ b/src/mailman/core/pipelines.py @@ -25,10 +25,9 @@ from mailman.core.i18n import _ from mailman.interfaces.handler import IHandler from mailman.interfaces.pipeline import ( DiscardMessage, IPipeline, RejectMessage) -from mailman.utilities.modules import find_components +from mailman.utilities.modules import add_components from public import public from zope.interface import implementer -from zope.interface.verify import verifyObject dlog = logging.getLogger('mailman.debug') @@ -139,13 +138,7 @@ class VirginPipeline(BasePipeline): def initialize(): """Initialize the pipelines.""" # Find all handlers in the registered plugins. - for handler_class in find_components('mailman.handlers', IHandler): - handler = handler_class() - verifyObject(IHandler, handler) - assert handler.name not in config.handlers, ( - 'Duplicate handler "{}" found in {}'.format( - handler.name, handler_class)) - config.handlers[handler.name] = handler + add_components('mailman.handlers', IHandler, config.handlers) # Set up some pipelines. for pipeline_class in (OwnerPipeline, PostingPipeline, VirginPipeline): pipeline = pipeline_class() -- cgit v1.2.3-70-g09d2