Barry Warsaw pushed to branch release-3.0 at mailman / Mailman

Commits:
9f32cac7 by Aurélien Bompard at 2015-11-21T19:54:25Z
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
@@ -58,6 +58,11 @@ Bugs
    Aurélien Bompard.  (Closes: #154)
  * 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.
+
+REST
+----
  * When ``[devmode]enabled`` is set, the JSON output is sorted.  Given by
    Aurélien Bompard.
 


=====================================
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/9f32cac7b81732d5535085d3eadc0213dbc8df9c
_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to