Barry Warsaw pushed to branch master at mailman / Mailman
Commits:
6c002fbd by Aurélien Bompard at 2015-11-21T19:51:28Z
Fix the approved rule when there is no list password
- - - - -
3 changed files:
- src/mailman/docs/NEWS.rst
- src/mailman/rules/approved.py
- src/mailman/rules/tests/test_approved.py
Changes:
=====================================
src/mailman/docs/NEWS.rst
=====================================
--- 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
-------------
=====================================
src/mailman/rules/approved.py
=====================================
--- 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.
=====================================
src/mailman/rules/tests/test_approved.py
=====================================
--- 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):
View it on GitLab:
https://gitlab.com/mailman/mailman/commit/6c002fbd75571f065c70f28034457a45e51af97c
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org