summaryrefslogtreecommitdiff
path: root/src/mailman/core/initialize.py
diff options
context:
space:
mode:
authorJ08nY2017-06-01 15:46:48 +0200
committerJ08nY2017-08-07 17:39:07 +0200
commit0d4f53b51892866b5cc85ace229b23f4b9bac896 (patch)
tree5394af7e3d9e8895babf93cf4af19480d14f53dd /src/mailman/core/initialize.py
parent38a86adcdb78c1944c26a5ab8deddff619b33bcf (diff)
downloadmailman-0d4f53b51892866b5cc85ace229b23f4b9bac896.tar.gz
mailman-0d4f53b51892866b5cc85ace229b23f4b9bac896.tar.zst
mailman-0d4f53b51892866b5cc85ace229b23f4b9bac896.zip
Diffstat (limited to 'src/mailman/core/initialize.py')
-rw-r--r--src/mailman/core/initialize.py29
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