Commit 6c002fbd authored by Aurélien Bompard's avatar Aurélien Bompard Committed by Barry Warsaw

Fix the approved rule when there is no list password

parent e9a522a4
Pipeline #273426 passed with stage
......@@ -44,6 +44,8 @@ Bugs
list is set to confirm-then-moderate. (Closes #114)
* Fix ``UnicodeEncodeError`` in the hold chain when sending the authorization
email to the mailing list moderators. (Closes: #144)
* Fix traceback in approved handler when the moderator password is None.
Given by Aurélien Bompard.
Configuration
-------------
......
......@@ -58,6 +58,8 @@ class Approved:
def check(self, mlist, msg, msgdata):
"""See `IRule`."""
if mlist.moderator_password is None:
return False
# See if the message has an Approved or Approve header with a valid
# moderator password. Also look at the first non-whitespace line in
# the file to see if it looks like an Approved header.
......
......@@ -138,6 +138,12 @@ A message body.
self._rule.check(self._mlist, self._msg, {})
self.assertEqual(self._msg['x-approve'], None)
def test_no_list_password(self):
self._mlist.moderator_password = None
self._msg['Approved'] = 'super secret'
result = self._rule.check(self._mlist, self._msg, {})
self.assertFalse(result)
class TestApprovedPseudoHeader(unittest.TestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment