Commit a8f2a1c6 authored by Barry Warsaw's avatar Barry Warsaw

Restore the RFC 2369 headers to accepted list posts.

parent de572e74
......@@ -2,12 +2,11 @@
Pipelines
=========
This runner's purpose in life is to process messages that have been accepted
for posting, applying any modifications and also sending copies of the message
to the archives, digests, nntp, and outgoing queues. Pipelines are named and
consist of a sequence of handlers, each of which is applied in turn. Unlike
rules and chains, there is no way to stop a pipeline from processing the
message once it's started.
Pipelines process messages that have been accepted for posting, applying any
modifications and also sending copies of the message to the archives, digests,
NNTP, and outgoing queues. Pipelines are named and consist of a sequence of
handlers, each of which is applied in turn. Unlike rules and chains, there is
no way to stop a pipeline from processing the message once it's started.
>>> mlist = create_list('[email protected]')
>>> print mlist.pipeline
......@@ -41,11 +40,21 @@ etc.
Subject: [Test] My first post
X-Mailman-Version: ...
Precedence: list
List-Id: <test.example.com>
X-Message-ID-Hash: 4CMWUN6BHVCMHMDAOSJZ2Q72G5M32MWB
List-Post: <mailto:[email protected]>
List-Subscribe: <http://lists.example.com/listinfo/[email protected]>,
<mailto:[email protected]>
Archived-At: http://lists.example.com/archives/4CMWUN6BHVCMHMDAOSJZ2Q72G5M32MWB
List-Unsubscribe: <http://lists.example.com/listinfo/[email protected]>,
<mailto:[email protected]>
List-Archive: <http://lists.example.com/archives/[email protected]>
List-Help: <mailto:[email protected]?subject=help>
<BLANKLINE>
First post!
<BLANKLINE>
And the message metadata has information about recipients and other stuff.
The message metadata has information about recipients and other stuff.
However there are currently no recipients for this message.
>>> dump_msgdata(msgdata)
......@@ -54,7 +63,8 @@ However there are currently no recipients for this message.
recipients : set([])
stripped_subject: My first post
And the message is now sitting in various other processing queues.
After pipeline processing, the message is now sitting in various other
processing queues.
>>> from mailman.testing.helpers import get_queue_messages
>>> messages = get_queue_messages('archive')
......@@ -67,6 +77,8 @@ And the message is now sitting in various other processing queues.
Subject: [Test] My first post
X-Mailman-Version: ...
Precedence: list
List-Id: <test.example.com>
...
<BLANKLINE>
First post!
<BLANKLINE>
......@@ -97,6 +109,8 @@ This is the message that will actually get delivered to end recipients.
Subject: [Test] My first post
X-Mailman-Version: ...
Precedence: list
List-Id: <test.example.com>
...
<BLANKLINE>
First post!
<BLANKLINE>
......@@ -122,6 +136,8 @@ There's now one message in the digest mailbox, getting ready to be sent.
Subject: [Test] My first post
X-Mailman-Version: ...
Precedence: list
List-Id: <test.example.com>
...
<BLANKLINE>
First post!
<BLANKLINE>
......
......@@ -91,6 +91,7 @@ class BuiltInPipeline(BasePipeline):
'cleanse',
'cleanse-dkim',
'cook-headers',
'rfc-2369',
'to-digest',
'to-archive',
'to-usenet',
......
# Copyright (C) 2012 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
"""Test the core modification pipelines."""
from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
__all__ = [
]
import unittest
from mailman.app.lifecycle import create_list
from mailman.core.pipelines import process
from mailman.testing.helpers import (
reset_the_world,
specialized_message_from_string as mfs)
from mailman.testing.layers import ConfigLayer
class TestBuiltinPipeline(unittest.TestCase):
"""Test various aspects of the built-in pipeline."""
layer = ConfigLayer
def setUp(self):
self._mlist = create_list('[email protected]')
def tearDown(self):
reset_the_world()
def test_rfc2369_headers(self):
# Ensure that RFC 2369 List-* headers are added.
msg = mfs("""\
From: Anne Person <[email protected]>
To: [email protected]
Subject: a test
testing
""")
msgdata = {}
process(self._mlist, msg, msgdata, pipeline_name='built-in')
self.assertEqual(msg['list-id'], '<test.example.com>')
self.assertEqual(msg['list-post'], '<mailto:[email protected]>')
......@@ -21,13 +21,16 @@ from __future__ import absolute_import, unicode_literals
__metaclass__ = type
__all__ = [
'process',
'RFC2369',
]
from email.utils import formataddr
from zope.interface import implements
from mailman.config import config
from mailman.core.i18n import _
from mailman.interfaces.handler import IHandler
from mailman.pipeline.cook_headers import uheader
CONTINUATION = ',\n\t'
......@@ -93,3 +96,17 @@ def process(mlist, msg, msgdata):
if len(h) + 2 + len(v) > 78:
v = CONTINUATION.join(v.split(', '))
msg[h] = v
class RFC2369:
"""Add the RFC 2369 List-* headers."""
implements(IHandler)
name = 'rfc-2369'
description = _('Add the RFC 2369 List-* headers.')
def process(self, mlist, msg, msgdata):
"""See `IHandler`."""
process(mlist, msg, msgdata)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment