summaryrefslogtreecommitdiff
path: root/src/mailman/styles
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/styles')
-rw-r--r--src/mailman/styles/default.py3
-rw-r--r--src/mailman/styles/docs/styles.rst2
-rw-r--r--src/mailman/styles/manager.py10
-rw-r--r--src/mailman/styles/tests/test_styles.py5
4 files changed, 8 insertions, 12 deletions
diff --git a/src/mailman/styles/default.py b/src/mailman/styles/default.py
index 01b6764da..97c57a94d 100644
--- a/src/mailman/styles/default.py
+++ b/src/mailman/styles/default.py
@@ -17,6 +17,7 @@
"""Application of list styles to new and existing lists."""
+from mailman.core.i18n import _
from mailman.interfaces.styles import IStyle
from mailman.styles.base import (
Announcement, BasicOperation, Bounces, Discussion, Identity, Moderation,
@@ -33,6 +34,7 @@ class LegacyDefaultStyle(
"""The legacy default style."""
name = 'legacy-default'
+ description = _('Ordinary discussion mailing list style.')
def apply(self, mailing_list):
"""See `IStyle`."""
@@ -52,6 +54,7 @@ class LegacyAnnounceOnly(
"""Similar to the legacy-default style, but for announce-only lists."""
name = 'legacy-announce'
+ description = _('Announce only mailing list style.')
def apply(self, mailing_list):
"""See `IStyle`."""
diff --git a/src/mailman/styles/docs/styles.rst b/src/mailman/styles/docs/styles.rst
index 270b0cdcc..a296bab54 100644
--- a/src/mailman/styles/docs/styles.rst
+++ b/src/mailman/styles/docs/styles.rst
@@ -49,6 +49,7 @@ New styles must implement the ``IStyle`` interface.
>>> @implementer(IStyle)
... class TestStyle:
... name = 'a-test-style'
+ ... description = 'Testing mailing list style.'
... def apply(self, mailing_list):
... # Just does something very simple.
... mailing_list.display_name = 'TEST STYLE LIST'
@@ -115,6 +116,7 @@ If no style name is provided when creating the list, the system default style
>>> @implementer(IStyle)
... class AnotherStyle:
... name = 'another-style'
+ ... description = 'Another testing mailing list style.'
... def apply(self, mailing_list):
... # Just does something very simple.
... mailing_list.display_name = 'ANOTHER STYLE LIST'
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`."""
diff --git a/src/mailman/styles/tests/test_styles.py b/src/mailman/styles/tests/test_styles.py
index a763082bf..a09967eb6 100644
--- a/src/mailman/styles/tests/test_styles.py
+++ b/src/mailman/styles/tests/test_styles.py
@@ -31,14 +31,11 @@ from zope.interface.exceptions import DoesNotImplement
class DummyStyle:
name = 'dummy'
- priority = 1
+ description = 'A dummy style.'
def apply(self, mlist):
pass
- def match(self, mlist, styles):
- styles.append(self)
-
class TestStyle(unittest.TestCase):
"""Test styles."""