Barry Warsaw pushed to branch master at mailman / Mailman

Commits:
eb322697 by Aurélien Bompard at 2015-09-23T20:49:12Z
Fix the logging of the moderation reasons

- - - - -
a5dc59ef by Barry Warsaw at 2015-09-23T20:51:30Z
Fix import order.

- - - - -
0e2e4b4e by Barry Warsaw at 2015-09-23T21:00:49Z
The logging of moderation reasons has been fixed.  Given by Aurélien Bompard.

- - - - -


3 changed files:

- src/mailman/chains/hold.py
- src/mailman/chains/tests/test_hold.py
- src/mailman/docs/NEWS.rst


Changes:

=====================================
src/mailman/chains/hold.py
=====================================
--- a/src/mailman/chains/hold.py
+++ b/src/mailman/chains/hold.py
@@ -247,7 +247,7 @@ also appear in the first line of the body of the 
reply.""")),
         # Log the held message.  Log messages are not translated, so recast
         # the reasons in the English.
         with _.using('en'):
-            reasons = _compose_reasons(msgdata)
+            reasons = msgdata.get('moderation_reasons', ['N/A'])
             log.info('HOLD: %s post from %s held, message-id=%s: %s',
                      mlist.fqdn_listname, msg.sender,
                      msg.get('message-id', 'n/a'), SEMISPACE.join(reasons))


=====================================
src/mailman/chains/tests/test_hold.py
=====================================
--- a/src/mailman/chains/tests/test_hold.py
+++ b/src/mailman/chains/tests/test_hold.py
@@ -31,7 +31,7 @@ from mailman.core.chains import process as process_chain
 from mailman.interfaces.autorespond import IAutoResponseSet, Response
 from mailman.interfaces.usermanager import IUserManager
 from mailman.testing.helpers import (
-    configuration, get_queue_messages,
+    LogFileMark, configuration, get_queue_messages,
     specialized_message_from_string as mfs)
 from mailman.testing.layers import ConfigLayer
 from zope.component import getUtility
@@ -115,6 +115,7 @@ A message body.
             'TEST-REASON-1',
             'TEST-REASON-2',
             ])
+        logfile = LogFileMark('mailman.vette')
         process_chain(self._mlist, msg, msgdata, start_chain='hold')
         messages = get_queue_messages('virgin')
         self.assertEqual(len(messages), 2)
@@ -131,3 +132,6 @@ A message body.
         self.assertIn('    TEST-REASON-2', payloads['owner'])
         self.assertIn('    TEST-REASON-1', payloads['sender'])
         self.assertIn('    TEST-REASON-2', payloads['sender'])
+        logged = logfile.read()
+        self.assertIn('TEST-REASON-1', logged)
+        self.assertIn('TEST-REASON-2', logged)


=====================================
src/mailman/docs/NEWS.rst
=====================================
--- a/src/mailman/docs/NEWS.rst
+++ b/src/mailman/docs/NEWS.rst
@@ -38,6 +38,8 @@ Bugs
  * Bulk emails are now decorated with headers and footers.  Given by Aurélien
    Bompard.  (Closes #145)
  * Core no longer depends on the standalone `mock` module.  (Closes: #146)
+ * The logging of moderation reasons has been fixed.  Given by Aurélien
+   Bompard.
 
 Configuration
 -------------



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/6c75191a230474d51505ba3269f14b9093b35863...0e2e4b4ee1799e6d0ae7a248b16ee6551f7f5e21
_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to