summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBarry Warsaw2015-09-13 20:30:19 +0000
committerBarry Warsaw2015-09-13 20:30:19 +0000
commit2f6a250ca38a8846c1d417c380d6311de35c3ee7 (patch)
tree79a077b3a16f18cea95e3f7b0620cebcab6f887b /src
parentccedcb5f4efaeb14300626ca00b3baf34af6e6e5 (diff)
parent9c710fe9fa1f95eb5eeafe29b0933bdf01492154 (diff)
downloadmailman-2f6a250ca38a8846c1d417c380d6311de35c3ee7.tar.gz
mailman-2f6a250ca38a8846c1d417c380d6311de35c3ee7.tar.zst
mailman-2f6a250ca38a8846c1d417c380d6311de35c3ee7.zip
Diffstat (limited to 'src')
-rw-r--r--src/mailman/app/docs/pipelines.rst11
-rw-r--r--src/mailman/core/pipelines.py1
-rw-r--r--src/mailman/core/tests/test_pipelines.py39
-rw-r--r--src/mailman/docs/NEWS.rst2
4 files changed, 52 insertions, 1 deletions
diff --git a/src/mailman/app/docs/pipelines.rst b/src/mailman/app/docs/pipelines.rst
index eb59fcfc2..46880b225 100644
--- a/src/mailman/app/docs/pipelines.rst
+++ b/src/mailman/app/docs/pipelines.rst
@@ -57,8 +57,15 @@ etc.
<mailto:test-join@example.com>
List-Unsubscribe: <http://lists.example.com/listinfo/test@example.com>,
<mailto:test-leave@example.com>
+ MIME-Version: 1.0
+ Content-Type: text/plain; charset="us-ascii"
+ Content-Transfer-Encoding: 7bit
<BLANKLINE>
First post!
+ _______________________________________________
+ Test mailing list
+ test@example.com
+ http://lists.example.com/listinfo/test@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
+ test@example.com
+ http://lists.example.com/listinfo/test@example.com
>>> dump_msgdata(messages[0].msgdata)
_parsemsg : False
diff --git a/src/mailman/core/pipelines.py b/src/mailman/core/pipelines.py
index b929dd23f..2a42b1b67 100644
--- 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',
)
diff --git a/src/mailman/core/tests/test_pipelines.py b/src/mailman/core/tests/test_pipelines.py
index 173be0dd9..134392668 100644
--- 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):
diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst
index a67d4a2d0..f6d381a7d 100644
--- a/src/mailman/docs/NEWS.rst
+++ b/src/mailman/docs/NEWS.rst
@@ -35,6 +35,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)
Configuration
-------------