Barry Warsaw pushed to branch master at mailman / Mailman
Commits:
18b4c4b0 by Aurélien Bompard at 2015-09-08T16:46:03Z
Decorate bulk emails by default
- - - - -
2d82e2c9 by Aurélien Bompard at 2015-09-12T10:54:22Z
Don't decorate the archive, digest or usenet copies
- - - - -
4e1da5d3 by Barry Warsaw at 2015-09-13T15:51:24Z
Neither archive messages nor digest messages get decorated.
- - - - -
0b8f1e55 by Barry Warsaw at 2015-09-13T16:04:58Z
A few minor cleanups.
- - - - -
9c710fe9 by Barry Warsaw at 2015-09-13T16:10:27Z
Add NEWS.
- - - - -
2f6a250c by Barry Warsaw at 2015-09-13T20:30:19Z
Merge branch 'issue145' into 'master'
Clean up branch to fix issue 145 (bulk emails not being decorated)
Clean up branch based on abompard's branch.
See merge request !44
- - - - -
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:[email protected]>
List-Unsubscribe: <http://lists.example.com/listinfo/[email protected]>,
<mailto:[email protected]>
+ MIME-Version: 1.0
+ Content-Type: text/plain; charset="us-ascii"
+ Content-Transfer-Encoding: 7bit
<BLANKLINE>
First post!
+ _______________________________________________
+ Test mailing list
+ [email protected]
+ http://lists.example.com/listinfo/[email protected]
<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
+ [email protected]
+ http://lists.example.com/listinfo/[email protected]
>>> 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
@@ -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
-------------
View it on GitLab:
https://gitlab.com/mailman/mailman/compare/ccedcb5f4efaeb14300626ca00b3baf34af6e6e5...2f6a250ca38a8846c1d417c380d6311de35c3ee7
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org