summaryrefslogtreecommitdiff
path: root/src/mailman/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/core')
-rw-r--r--src/mailman/core/initialize.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/mailman/core/initialize.py b/src/mailman/core/initialize.py
index a1314b51e..830bd9b84 100644
--- a/src/mailman/core/initialize.py
+++ b/src/mailman/core/initialize.py
@@ -31,7 +31,9 @@ import traceback
import mailman.config.config
import mailman.core.logging
+from mailman.core.i18n import _
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
@@ -152,27 +154,28 @@ def initialize_2(debug=False, propagate_logs=None, testing=False):
initialize_plugins()
# Check for deprecated features in config.
config = mailman.config.config
- if 'pre_hook' in config.mailman: # pragma: no cover
+ if config.mailman.pre_hook: # pragma: nocover
warnings.warn(
- 'The pre_hook configuration value has been replaced by the '
- 'plugins infrastructure.', DeprecationWarning)
+ _('The pre_hook configuration value has been replaced by the '
+ 'plugins infrastructure.'), UserWarning)
+ call_name(config.mailman.pre_hook)
# Run the plugin pre_hooks, if one fails, disable the offending plugin.
for name in list(config.plugins.keys()):
plugin = config.plugins[name]
try:
plugin.pre_hook()
- except BaseException: # pragma: no cover
+ except: # pragma: nocover
traceback.print_exc()
- warnings.warn('Plugin {} failed to run its pre_hook,'
- 'it will be disabled and its components'
- 'wont be loaded.'.format(name), RuntimeWarning)
+ warnings.warn(_('Plugin $name failed to run its pre_hook,'
+ 'it will be disabled and its components'
+ 'wont be loaded.'), RuntimeWarning)
# It failed, push disabling overlay to config. This will stop
# components from being loaded.
config.push(name + '_error', """\
[plugin.{}]
enable: no
""".format(name))
- # And forget about it. This will stop running its pot_hook.
+ # And forget about it. This will stop running its post_hook.
del config.plugins[name]
# Instantiate the database class, ensure that it's of the right type, and
# initialize it. Then stash the object on our configuration object.
@@ -199,14 +202,15 @@ def initialize_3():
"""
# Run the plugin post_hooks
config = mailman.config.config
- if 'post_hook' in config.mailman: # pragma: no cover
+ if config.mailman.post_hook: # pragma: nocover
warnings.warn(
- 'The post_hook configuration value has been replaced by the '
- 'plugins infrastructure.', DeprecationWarning)
+ _('The post_hook configuration value has been replaced by the '
+ 'plugins infrastructure.'), UserWarning)
+ call_name(config.mailman.post_hook)
for plugin in config.plugins.values():
try:
plugin.post_hook()
- except: # pragma: no cover
+ except: # pragma: nocover
# A post_hook may fail, here we just hope for the best that the
# plugin can work even if it post_hook failed as it's components
# are already loaded.