summaryrefslogtreecommitdiff
path: root/src/mailman/core
diff options
context:
space:
mode:
authorBarry Warsaw2016-01-25 14:59:36 -0500
committerBarry Warsaw2016-01-25 14:59:36 -0500
commitd063ee4dd4579ca931e36f0761084e4ab7cd0335 (patch)
treee1ee71db22560274a82a68dd082f35ee0d5ad3ee /src/mailman/core
parent471851bab74874f02de08d71a3c1256c3ec6390d (diff)
downloadmailman-d063ee4dd4579ca931e36f0761084e4ab7cd0335.tar.gz
mailman-d063ee4dd4579ca931e36f0761084e4ab7cd0335.tar.zst
mailman-d063ee4dd4579ca931e36f0761084e4ab7cd0335.zip
Make creating Link objects a more convenient.
Link.__init__() can now take an IRule or the string naming a rule, which will be looked up in config.rules. Similarly, it can take an IChain or the name of a chain.
Diffstat (limited to 'src/mailman/core')
-rw-r--r--src/mailman/core/chains.py4
-rw-r--r--src/mailman/core/rules.py4
2 files changed, 2 insertions, 6 deletions
diff --git a/src/mailman/core/chains.py b/src/mailman/core/chains.py
index 3d9b2f364..6a98b2a33 100644
--- a/src/mailman/core/chains.py
+++ b/src/mailman/core/chains.py
@@ -30,7 +30,6 @@ from mailman.utilities.modules import find_components
from zope.interface.verify import verifyObject
-
def process(mlist, msg, msgdata, start_chain='default-posting-chain'):
"""Process the message through a chain.
@@ -93,7 +92,6 @@ def process(mlist, msg, msgdata, start_chain='default-posting-chain'):
misses.append(link.rule.name)
-
def initialize():
"""Set up chains, both built-in and from the database."""
for chain_class in find_components('mailman.chains', IChain):
@@ -107,7 +105,7 @@ def initialize():
chain = chain_class()
verifyObject(IChain, chain)
assert chain.name not in config.chains, (
- 'Duplicate chain "{0}" found in {1} (previously: {2}'.format(
+ 'Duplicate chain "{}" found in {} (previously: {}'.format(
chain.name, chain_class, config.chains[chain.name]))
config.chains[chain.name] = chain
# XXX Read chains from the database and initialize them.
diff --git a/src/mailman/core/rules.py b/src/mailman/core/rules.py
index 702e7f60c..b593214f8 100644
--- a/src/mailman/core/rules.py
+++ b/src/mailman/core/rules.py
@@ -28,7 +28,6 @@ from mailman.utilities.modules import find_components
from zope.interface.verify import verifyObject
-
def initialize():
"""Find and register all rules in all plugins."""
# Find rules in plugins.
@@ -36,6 +35,5 @@ def initialize():
rule = rule_class()
verifyObject(IRule, rule)
assert rule.name not in config.rules, (
- 'Duplicate rule "{0}" found in {1}'.format(
- rule.name, rule_class))
+ 'Duplicate rule "{}" found in {}'.format(rule.name, rule_class))
config.rules[rule.name] = rule