diff options
| author | J08nY | 2017-05-31 02:09:09 +0200 |
|---|---|---|
| committer | J08nY | 2017-08-07 17:39:07 +0200 |
| commit | 38a86adcdb78c1944c26a5ab8deddff619b33bcf (patch) | |
| tree | c9b6f8810e33657161535bb887829305306ce0f2 /src/mailman/styles/manager.py | |
| parent | 324226f1f859f6be5e932dc9abe638aba268d154 (diff) | |
| download | mailman-38a86adcdb78c1944c26a5ab8deddff619b33bcf.tar.gz mailman-38a86adcdb78c1944c26a5ab8deddff619b33bcf.tar.zst mailman-38a86adcdb78c1944c26a5ab8deddff619b33bcf.zip | |
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.
Diffstat (limited to '')
| -rw-r--r-- | src/mailman/styles/manager.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/mailman/styles/manager.py b/src/mailman/styles/manager.py index 1ec83b2a9..1969d4484 100644 --- a/src/mailman/styles/manager.py +++ b/src/mailman/styles/manager.py @@ -20,7 +20,7 @@ from mailman.interfaces.configuration import ConfigurationUpdatedEvent from mailman.interfaces.styles import ( DuplicateStyleError, IStyle, IStyleManager) -from mailman.utilities.modules import add_components +from mailman.utilities.plugins import add_pluggable_components from public import public from zope.component import getUtility from zope.interface import implementer @@ -38,13 +38,7 @@ class StyleManager: def populate(self): self._styles.clear() - # Avoid circular imports. - from mailman.config import config - # Calculate the Python import paths to search. - paths = filter(None, (path.strip() - for path in config.styles.paths.splitlines())) - for path in paths: - add_components(path, IStyle, self._styles) + add_pluggable_components('styles', IStyle, self._styles) def get(self, name): """See `IStyleManager`.""" |
