diff options
Diffstat (limited to 'src/mailman/core/initialize.py')
| -rw-r--r-- | src/mailman/core/initialize.py | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/mailman/core/initialize.py b/src/mailman/core/initialize.py index dc67e9a68..18e874552 100644 --- a/src/mailman/core/initialize.py +++ b/src/mailman/core/initialize.py @@ -26,11 +26,11 @@ by the command line arguments. import os import sys +import warnings import mailman.config.config import mailman.core.logging from mailman.interfaces.database import IDatabaseFactory -from mailman.utilities.modules import call_name from pkg_resources import resource_string as resource_bytes from public import public from zope.component import getUtility @@ -133,7 +133,7 @@ def initialize_2(debug=False, propagate_logs=None, testing=False): * Database * Logging - * Pre-hook + * Plugin's pre_hook * Rules * Chains * Pipelines @@ -146,10 +146,17 @@ def initialize_2(debug=False, propagate_logs=None, testing=False): """ # Create the queue and log directories if they don't already exist. mailman.core.logging.initialize(propagate_logs) - # Run the pre-hook if there is one. + # Initialize plugins + from mailman.core.plugins import initialize as initialize_plugins + initialize_plugins() + # Run the plugin pre_hooks config = mailman.config.config - if config.mailman.pre_hook: - call_name(config.mailman.pre_hook) + if "pre_hook" in config.mailman: # pragma: no cover + warnings.warn( + "The pre_hook configuration value has been replaced by the " + "plugins infrastructure.", DeprecationWarning) + for plugin in config.plugins.values(): + plugin.pre_hook() # Instantiate the database class, ensure that it's of the right type, and # initialize it. Then stash the object on our configuration object. utility_name = ('testing' if testing else 'production') @@ -171,12 +178,16 @@ def initialize_2(debug=False, propagate_logs=None, testing=False): def initialize_3(): """Third initialization step. - * Post-hook + * Plugin's post_hook """ - # Run the post-hook if there is one. + # Run the plugin post_hooks config = mailman.config.config - if config.mailman.post_hook: - call_name(config.mailman.post_hook) + if "post_hook" in config.mailman: # pragma: no cover + warnings.warn( + "The post_hook configuration value has been replaced by the " + "plugins infrastructure.", DeprecationWarning) + for plugin in config.plugins.values(): + plugin.post_hook() @public |
