summaryrefslogtreecommitdiff
path: root/src/mailman/interfaces/styles.py
diff options
context:
space:
mode:
authorBarry Warsaw2012-12-30 14:39:10 -0500
committerBarry Warsaw2012-12-30 14:39:10 -0500
commita0244a524117c90cbf22f0007b96933c4fb2aa4b (patch)
tree21fc100ba690971aa1310fb08c82fedc5f38084c /src/mailman/interfaces/styles.py
parent2450a9c9642d06af1a60df70acb742e67959d77e (diff)
parent5ec8a131c602f9b00d6b25d914ffc923cd1aa964 (diff)
downloadmailman-a0244a524117c90cbf22f0007b96933c4fb2aa4b.tar.gz
mailman-a0244a524117c90cbf22f0007b96933c4fb2aa4b.tar.zst
mailman-a0244a524117c90cbf22f0007b96933c4fb2aa4b.zip
* List styles are supported through the REST API. Get the list of available
styles (by name) via `.../lists/styles`. Create a list in a specific style by using POST data `style_name=<style>`. (LP: #975692) * The default list style is renamed to `legacy-default` and a new `legacy-announce` style is added. This is similar to the `legacy-default` except set up for announce-only lists. * The following columns were unused and have been removed: - `mailinglist.new_member_options` - `mailinglist.send_reminders` - `mailinglist.subscribe_policy` - `mailinglist.unsubscribe_policy` - `mailinglist.subscribe_auto_approval` - `mailinglist.private_roster` - `mailinglist.admin_member_chunksize` Also: * List styles no longer have a priority, nor is there any style matching any more. Now, exactly one named style (either explicitly through the `create_list()` function, or by default from the configuration file) is applied to a list at list creation time. * The huge old DefaultStyle is now decomposed into smaller units. An announce-like style is added. * `find_components()` and `scan_module()` moved from `app/finder.py` to `utilities/modules.py`. * Lots of doctest rewriting for better documentation. Bad-path tests moved to unittests. * `create_list()` now takes an optional `style_name` parameter. If not given, `[styles]default` is used. * `create_list()` doesn't set the `personalize` or `display_name` attributes any more. These are already set in styles. * Removed an unnecessary `tearDown()`. * Added some improvements on displaying lists in JSON responses.
Diffstat (limited to 'src/mailman/interfaces/styles.py')
-rw-r--r--src/mailman/interfaces/styles.py48
1 files changed, 8 insertions, 40 deletions
diff --git a/src/mailman/interfaces/styles.py b/src/mailman/interfaces/styles.py
index 8dfd52145..4a7b69dcb 100644
--- a/src/mailman/interfaces/styles.py
+++ b/src/mailman/interfaces/styles.py
@@ -43,9 +43,6 @@ class IStyle(Interface):
name = Attribute(
"""The name of this style. Must be unique.""")
- priority = Attribute(
- """The priority of this style, as an integer.""")
-
def apply(mailing_list):
"""Apply the style to the mailing list.
@@ -53,50 +50,28 @@ class IStyle(Interface):
:param mailing_list: the mailing list to apply the style to.
"""
- def match(mailing_list, styles):
- """Give this style a chance to match the mailing list.
-
- If the style's internal matching rules match the `mailing_list`, then
- the style may append itself to the `styles` list. This list will be
- ordered when returned from `IStyleManager.lookup()`.
-
- :type mailing_list: `IMailingList`.
- :param mailing_list: the mailing list object.
- :param styles: ordered list of `IStyles` matched so far.
- """
-
-
class IStyleManager(Interface):
- """A manager of styles and style chains."""
+ """A manager of styles."""
def get(name):
"""Return the named style or None.
- :type name: Unicode
+ :type name: string
:param name: A style name.
:return: the named `IStyle` or None if the style doesn't exist.
"""
- def lookup(mailing_list):
- """Return a list of styles for the given mailing list.
-
- Use various registered rules to find an `IStyle` for the given mailing
- list. The returned styles are ordered by their priority.
+ styles = Attribute(
+ 'An iterator over all the styles known by this manager.')
- Style matches can be registered and reordered by plugins.
+ def populate():
+ """Populate the styles from the configuration files.
- :type mailing_list: `IMailingList`.
- :param mailing_list: The mailing list object to find a style for.
- :return: ordered list of `IStyles`. Zero is the lowest priority.
+ This clears the current set of styles and resets them from those
+ defined in the configuration files.
"""
- styles = Attribute(
- """An iterator over all the styles known by this manager.
-
- Styles are ordered by their priority, which may be changed.
- """)
-
def register(style):
"""Register a style with this manager.
@@ -111,10 +86,3 @@ class IStyleManager(Interface):
:param style: an IStyle.
:raises KeyError: If the style's name is not currently registered.
"""
-
- def populate():
- """Populate the styles from the configuration files.
-
- This clears the current set of styles and resets them from those
- defined in the configuration files.
- """