diff options
| -rw-r--r-- | src/mailman/docs/NEWS.rst | 2 | ||||
| -rw-r--r-- | src/mailman/rules/approved.py | 2 | ||||
| -rw-r--r-- | src/mailman/rules/tests/test_approved.py | 6 |
3 files changed, 10 insertions, 0 deletions
diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst index 8d8d793b8..a26e18c8a 100644 --- a/src/mailman/docs/NEWS.rst +++ b/src/mailman/docs/NEWS.rst @@ -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 ------------- diff --git a/src/mailman/rules/approved.py b/src/mailman/rules/approved.py index 248c3f73e..ff82145a4 100644 --- a/src/mailman/rules/approved.py +++ b/src/mailman/rules/approved.py @@ -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. diff --git a/src/mailman/rules/tests/test_approved.py b/src/mailman/rules/tests/test_approved.py index 7bac07dcc..6a36f2429 100644 --- a/src/mailman/rules/tests/test_approved.py +++ b/src/mailman/rules/tests/test_approved.py @@ -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): |
