From 38a86adcdb78c1944c26a5ab8deddff619b33bcf Mon Sep 17 00:00:00 2001 From: J08nY Date: Wed, 31 May 2017 02:09:09 +0200 Subject: Add pluggable components. - Adds the notion of a 'plugin'. - A plugin has a package path and a flag specifying whether it's enabled or not. - Adds a find_pluggable_components function similar to the find_components one. This one dynamically searches not only the mailman package but all of plugins. - e.g. find_pluggable_components('rules', IRule) finds all IRule components in mailman.rules but also in example_plugin.rules for plugin names example_plugin. - Uses the find_pluggable_components function in place of find_components when searching for Rules, Handlers, Chains, EmailCommands, and Styles. --- src/mailman/core/chains.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/mailman/core/chains.py') diff --git a/src/mailman/core/chains.py b/src/mailman/core/chains.py index c251d38bc..48ed82d63 100644 --- a/src/mailman/core/chains.py +++ b/src/mailman/core/chains.py @@ -19,7 +19,7 @@ from mailman.config import config from mailman.interfaces.chain import IChain, LinkAction -from mailman.utilities.modules import add_components +from mailman.utilities.plugins import add_pluggable_components from public import public @@ -89,5 +89,4 @@ def process(mlist, msg, msgdata, start_chain='default-posting-chain'): @public def initialize(): """Set up chains, both built-in and from the database.""" - add_components('mailman.chains', IChain, config.chains) - # XXX Read chains from the database and initialize them. + add_pluggable_components('chains', IChain, config.chains) -- cgit v1.2.3-70-g09d2