summaryrefslogtreecommitdiff
path: root/src/mailman/chains
diff options
context:
space:
mode:
authorAurélien Bompard2016-02-29 12:08:43 +0100
committerBarry Warsaw2016-02-29 21:52:13 -0500
commit9684f1fc0e8bbe2c41566bf16dab92a0ff0f8b81 (patch)
tree19ccd0ee3a5d7500a4ad97f792a040ece7ffc663 /src/mailman/chains
parentef9cdf45000b1172c3973b329ebe7ed32d604fb1 (diff)
downloadmailman-9684f1fc0e8bbe2c41566bf16dab92a0ff0f8b81.tar.gz
mailman-9684f1fc0e8bbe2c41566bf16dab92a0ff0f8b81.tar.zst
mailman-9684f1fc0e8bbe2c41566bf16dab92a0ff0f8b81.zip
Diffstat (limited to 'src/mailman/chains')
-rw-r--r--src/mailman/chains/headers.py7
-rw-r--r--src/mailman/chains/tests/test_headers.py9
2 files changed, 6 insertions, 10 deletions
diff --git a/src/mailman/chains/headers.py b/src/mailman/chains/headers.py
index d3db30b23..23ad79fdf 100644
--- a/src/mailman/chains/headers.py
+++ b/src/mailman/chains/headers.py
@@ -150,9 +150,6 @@ class HeaderMatchChain(Chain):
yield Link('any', LinkAction.jump, config.antispam.jump_chain)
# Then return all the list-specific header matches.
for entry in mlist.header_matches:
- if entry.action is None:
- # Default to the default antispam chain.
- chain = config.antispam.jump_chain
- else:
- chain = entry.action.name
+ # Jump to the default antispam chain if the entry chain is None.
+ chain = entry.chain or config.antispam.jump_chain
yield make_link(entry.header, entry.pattern, chain)
diff --git a/src/mailman/chains/tests/test_headers.py b/src/mailman/chains/tests/test_headers.py
index 28c3e1cdc..693f132d0 100644
--- a/src/mailman/chains/tests/test_headers.py
+++ b/src/mailman/chains/tests/test_headers.py
@@ -29,7 +29,6 @@ from mailman.chains.headers import HeaderMatchRule, make_link
from mailman.config import config
from mailman.core.chains import process
from mailman.email.message import Message
-from mailman.interfaces.action import Action
from mailman.interfaces.chain import LinkAction, HoldEvent, DiscardEvent
from mailman.interfaces.configuration import ConfigurationUpdatedEvent
from mailman.interfaces.mailinglist import IHeaderMatchList
@@ -163,9 +162,9 @@ class TestHeaderChain(unittest.TestCase):
# properly.
chain = config.chains['header-match']
header_matches = IHeaderMatchList(self._mlist)
- header_matches.append('Foo', 'a+', Action.reject)
- header_matches.append('Bar', 'b+', Action.discard)
- header_matches.append('Baz', 'z+', Action.accept)
+ header_matches.append('Foo', 'a+', 'reject')
+ header_matches.append('Bar', 'b+', 'discard')
+ header_matches.append('Baz', 'z+', 'accept')
links = [link for link in chain.get_links(self._mlist, Message(), {})
if link.rule.name != 'any']
self.assertEqual(len(links), 3)
@@ -196,7 +195,7 @@ A message body.
""")
msgdata = {}
header_matches = IHeaderMatchList(self._mlist)
- header_matches.append('Foo', 'foo', Action.accept)
+ header_matches.append('Foo', 'foo', 'accept')
# This event subscriber records the event that occurs when the message
# is processed by the owner chain.
events = []