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

Commits:
f1409df5 by Aurélien Bompard at 2015-09-13T16:20:31Z
Decorate bulk emails by default

- - - - -
3256137a by Aurélien Bompard at 2015-09-13T16:20:32Z
Don't decorate the archive, digest or usenet copies

- - - - -
681bf814 by Barry Warsaw at 2015-09-13T16:20:32Z
Neither archive messages nor digest messages get decorated.

- - - - -
7dea5e3d by Barry Warsaw at 2015-09-13T16:20:32Z
A few minor cleanups.

- - - - -
97931c8a by Barry Warsaw at 2015-09-13T16:22:06Z
Add NEWS

- - - - -


4 changed files:

- src/mailman/app/docs/pipelines.rst
- src/mailman/core/pipelines.py
- src/mailman/core/tests/test_pipelines.py
- src/mailman/docs/NEWS.rst


Changes:

=====================================
src/mailman/app/docs/pipelines.rst
=====================================
--- a/src/mailman/app/docs/pipelines.rst
+++ b/src/mailman/app/docs/pipelines.rst
@@ -57,8 +57,15 @@ etc.
      <mailto:test-j...@example.com>
     List-Unsubscribe: <http://lists.example.com/listinfo/t...@example.com>,
      <mailto:test-le...@example.com>
+    MIME-Version: 1.0
+    Content-Type: text/plain; charset="us-ascii"
+    Content-Transfer-Encoding: 7bit
     <BLANKLINE>
     First post!
+    _______________________________________________
+    Test mailing list
+    t...@example.com
+    http://lists.example.com/listinfo/t...@example.com
     <BLANKLINE>
 
 The message metadata has information about recipients and other stuff.
@@ -129,6 +136,10 @@ delivered to end recipients.
     <BLANKLINE>
     First post!
     <BLANKLINE>
+    _______________________________________________
+    Test mailing list
+    t...@example.com
+    http://lists.example.com/listinfo/t...@example.com
 
     >>> dump_msgdata(messages[0].msgdata)
     _parsemsg       : False


=====================================
src/mailman/core/pipelines.py
=====================================
--- a/src/mailman/core/pipelines.py
+++ b/src/mailman/core/pipelines.py
@@ -123,6 +123,7 @@ class PostingPipeline(BasePipeline):
         'to-usenet',
         'after-delivery',
         'acknowledge',
+        'decorate',
         'to-outgoing',
         )
 


=====================================
src/mailman/core/tests/test_pipelines.py
=====================================
--- a/src/mailman/core/tests/test_pipelines.py
+++ b/src/mailman/core/tests/test_pipelines.py
@@ -34,7 +34,7 @@ from mailman.interfaces.member import MemberRole
 from mailman.interfaces.pipeline import IPipeline
 from mailman.interfaces.usermanager import IUserManager
 from mailman.testing.helpers import (
-    LogFileMark, get_queue_messages, reset_the_world,
+    LogFileMark, digest_mbox, get_queue_messages, reset_the_world,
     specialized_message_from_string as mfs)
 from mailman.testing.layers import ConfigLayer
 from zope.component import getUtility
@@ -133,6 +133,43 @@ testing
         self.assertEqual(len(messages), 1)
         self.assertEqual(str(messages[0].msg['subject']), 'a test')
 
+    def test_decorate_bulk(self):
+        # Ensure that bulk postings get decorated with the footer.
+        process(self._mlist, self._msg, {},
+                pipeline_name='default-posting-pipeline')
+        payload = self._msg.get_payload()
+        self.assertIn('Test mailing list', payload)
+
+    def test_nodecorate_verp(self):
+        # Ensure that verp postings don't get decorated twice.
+        msgdata = {'verp': True}
+        process(self._mlist, self._msg, msgdata,
+                pipeline_name='default-posting-pipeline')
+        payload = self._msg.get_payload()
+        self.assertEqual(payload.count('Test mailing list'), 1)
+
+    def test_only_decorate_output(self):
+        # Ensure that decoration is not done on the archive, digest, or
+        # usenet copy of the message.
+        self.assertTrue(self._mlist.digestable)
+        # Set up NNTP.
+        self._mlist.gateway_to_news = True
+        self._mlist.linked_newsgroup = 'testing'
+        self._mlist.nntp_host = 'news.example.com'
+        # Process the email.
+        process(self._mlist, self._msg, {},
+                pipeline_name='default-posting-pipeline')
+        for queue in ('archive', 'nntp'):
+            messages = get_queue_messages(queue)
+            self.assertEqual(
+                len(messages), 1,
+                'Queue {} has {} messages'.format(queue, len(messages)))
+            payload = messages[0].msg.get_payload()
+            self.assertNotIn('Test mailing list', payload)
+        self.assertEqual(len(digest_mbox(self._mlist)), 1)
+        payload = digest_mbox(self._mlist)[0].get_payload()
+        self.assertNotIn('Test mailing list', payload)
+
 
 
 class TestOwnerPipeline(unittest.TestCase):


=====================================
src/mailman/docs/NEWS.rst
=====================================
--- a/src/mailman/docs/NEWS.rst
+++ b/src/mailman/docs/NEWS.rst
@@ -41,6 +41,8 @@ Bugs
    recipients for that digest.
  * For Python versions earlier than 3.5, use a compatibility layer for a
    backported smtpd module which can accept non-UTF-8 data.  (Closes #140)
+ * Bulk emails are now decorated with headers and footers.  Given by Aurélien
+   Bompard.  (Closes #145)
 
 
 3.0.0 -- "Show Don't Tell"



View it on GitLab: 
https://gitlab.com/mailman/mailman/compare/467ae81647d45a95948da45e6dd28bb4467de912...97931c8a770faa35aebed9cba9e90c788b042c23
_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to