diff options
Diffstat (limited to 'src/mailman/pipeline')
| -rw-r--r-- | src/mailman/pipeline/docs/ack-headers.txt | 6 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/acknowledge.txt | 6 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/after-delivery.txt | 6 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/avoid-duplicates.txt | 6 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/calc-recips.txt | 6 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/cleanse.txt | 6 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/decorate.txt | 5 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/file-recips.txt | 6 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/nntp.txt | 10 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/reply-to.txt | 7 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/scrubber.txt | 9 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/subject-munging.txt | 7 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/tagger.txt | 6 | ||||
| -rw-r--r-- | src/mailman/pipeline/docs/to-outgoing.txt | 8 |
14 files changed, 60 insertions, 34 deletions
diff --git a/src/mailman/pipeline/docs/ack-headers.txt b/src/mailman/pipeline/docs/ack-headers.txt index 49b203cad..ddaa313dc 100644 --- a/src/mailman/pipeline/docs/ack-headers.txt +++ b/src/mailman/pipeline/docs/ack-headers.txt @@ -8,8 +8,8 @@ transformations. Some headers get added, others get changed. Some of these changes depend on mailing list settings and others depend on how the message is getting sent through the system. We'll take things one-by-one. - >>> from mailman.pipeline.cook_headers import process - >>> mlist = config.db.list_manager.create('_xtest@example.com') + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') >>> mlist.subject_prefix = '' When the message's metadata has a 'noack' key set, an 'X-Ack: no' header is @@ -20,6 +20,8 @@ added. ... ... A message of great import. ... """) + + >>> from mailman.pipeline.cook_headers import process >>> process(mlist, msg, dict(noack=True)) >>> print msg.as_string() From: aperson@example.com diff --git a/src/mailman/pipeline/docs/acknowledge.txt b/src/mailman/pipeline/docs/acknowledge.txt index 72292cd80..bde84349f 100644 --- a/src/mailman/pipeline/docs/acknowledge.txt +++ b/src/mailman/pipeline/docs/acknowledge.txt @@ -6,8 +6,8 @@ When a user posts a message to a mailing list, and that user has chosen to receive acknowledgments of their postings, Mailman will sent them such an acknowledgment. - >>> handler = config.handlers['acknowledge'] - >>> mlist = config.db.list_manager.create('_xtest@example.com') + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') >>> mlist.real_name = 'XTest' >>> mlist.preferred_language = 'en' >>> # XXX This will almost certainly change once we've worked out the web @@ -38,6 +38,8 @@ Non-members can't get acknowledgments of their posts to the mailing list. ... From: bperson@example.com ... ... """) + + >>> handler = config.handlers['acknowledge'] >>> handler.process(mlist, msg, {}) >>> virginq.files [] diff --git a/src/mailman/pipeline/docs/after-delivery.txt b/src/mailman/pipeline/docs/after-delivery.txt index da1a3af08..19673d91c 100644 --- a/src/mailman/pipeline/docs/after-delivery.txt +++ b/src/mailman/pipeline/docs/after-delivery.txt @@ -7,8 +7,8 @@ by the rest of the handlers in the incoming queue pipeline, a couple of bookkeeping pieces of information are updated. >>> import datetime - >>> handler = config.handlers['after-delivery'] - >>> mlist = config.db.list_manager.create('_xtest@example.com') + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') >>> post_time = datetime.datetime.now() - datetime.timedelta(minutes=10) >>> mlist.last_post_time = post_time >>> mlist.post_id = 10 @@ -21,6 +21,8 @@ attributes. ... ... Something interesting. ... """) + + >>> handler = config.handlers['after-delivery'] >>> handler.process(mlist, msg, {}) >>> mlist.last_post_time > post_time True diff --git a/src/mailman/pipeline/docs/avoid-duplicates.txt b/src/mailman/pipeline/docs/avoid-duplicates.txt index adca9cbe5..aef50aa6e 100644 --- a/src/mailman/pipeline/docs/avoid-duplicates.txt +++ b/src/mailman/pipeline/docs/avoid-duplicates.txt @@ -7,8 +7,8 @@ reduce the reception of duplicate messages. It does this by removing certain recipients from the list of recipients that earlier handler modules (e.g. CalcRecips) calculates. - >>> handler = config.handlers['avoid-duplicates'] - >>> mlist = config.db.list_manager.create('_xtest@example.com') + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') Create some members we're going to use. @@ -36,6 +36,8 @@ The module short-circuits if there are no recipients. ... Something ... """) >>> msgdata = {} + + >>> handler = config.handlers['avoid-duplicates'] >>> handler.process(mlist, msg, msgdata) >>> msgdata {} diff --git a/src/mailman/pipeline/docs/calc-recips.txt b/src/mailman/pipeline/docs/calc-recips.txt index 03a22e5dc..e787e650d 100644 --- a/src/mailman/pipeline/docs/calc-recips.txt +++ b/src/mailman/pipeline/docs/calc-recips.txt @@ -6,8 +6,8 @@ Every message that makes it through to the list membership gets sent to a set of recipient addresses. These addresses are calculated by one of the handler modules and depends on a host of factors. - >>> handler = config.handlers['calculate-recipients'] - >>> mlist = config.db.list_manager.create('_xtest@example.com') + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') Recipients are calculate from the list members, so add a bunch of members to start out with. First, create a bunch of addresses... @@ -52,6 +52,8 @@ but not all of the recipients. ... """) >>> recips = set(('qperson@example.com', 'zperson@example.com')) >>> msgdata = dict(recips=recips) + + >>> handler = config.handlers['calculate-recipients'] >>> handler.process(mlist, msg, msgdata) >>> sorted(msgdata['recips']) [u'qperson@example.com', u'zperson@example.com'] diff --git a/src/mailman/pipeline/docs/cleanse.txt b/src/mailman/pipeline/docs/cleanse.txt index 778ecb19d..a1838d36e 100644 --- a/src/mailman/pipeline/docs/cleanse.txt +++ b/src/mailman/pipeline/docs/cleanse.txt @@ -6,8 +6,8 @@ All messages posted to a list get their headers cleansed. Some headers are related to additional permissions that can be granted to the message and other headers can be used to fish for membership. - >>> handler = config.handlers['cleanse'] - >>> mlist = config.db.list_manager.create('_xtest@example.com') + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') Headers such as Approved, Approve, and Urgent are used to grant special pemissions to individual messages. All may contain a password; the first two @@ -25,6 +25,8 @@ headers contain passwords, they must be removed from any posted message. ... ... Blah blah blah ... """) + + >>> handler = config.handlers['cleanse'] >>> handler.process(mlist, msg, {}) >>> print msg.as_string() From: aperson@example.com diff --git a/src/mailman/pipeline/docs/decorate.txt b/src/mailman/pipeline/docs/decorate.txt index ee2f4d10e..42afe9a80 100644 --- a/src/mailman/pipeline/docs/decorate.txt +++ b/src/mailman/pipeline/docs/decorate.txt @@ -6,8 +6,8 @@ Message decoration is the process of adding headers and footers to the original message. A handler module takes care of this based on the settings of the mailing list and the type of message being processed. - >>> from mailman.pipeline.decorate import process - >>> mlist = config.db.list_manager.create('_xtest@example.com') + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') >>> msg_text = """\ ... From: aperson@example.org ... @@ -22,6 +22,7 @@ Short circuiting Digest messages get decorated during the digest creation phase so no extra decorations are added for digest messages. + >>> from mailman.pipeline.decorate import process >>> process(mlist, msg, dict(isdigest=True)) >>> print msg.as_string() From: aperson@example.org diff --git a/src/mailman/pipeline/docs/file-recips.txt b/src/mailman/pipeline/docs/file-recips.txt index 479ae9975..2c9d7724f 100644 --- a/src/mailman/pipeline/docs/file-recips.txt +++ b/src/mailman/pipeline/docs/file-recips.txt @@ -6,8 +6,8 @@ Mailman can calculate the recipients for a message from a Sendmail-style include file. This file must be called members.txt and it must live in the list's data directory. - >>> handler = config.handlers['file-recipients'] - >>> mlist = config.db.list_manager.create('_xtest@example.com') + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') Short circuiting @@ -22,6 +22,8 @@ returns. ... A message. ... """) >>> msgdata = {'recips': 7} + + >>> handler = config.handlers['file-recipients'] >>> handler.process(mlist, msg, msgdata) >>> print msg.as_string() From: aperson@example.com diff --git a/src/mailman/pipeline/docs/nntp.txt b/src/mailman/pipeline/docs/nntp.txt index dda104309..7b013aabf 100644 --- a/src/mailman/pipeline/docs/nntp.txt +++ b/src/mailman/pipeline/docs/nntp.txt @@ -6,10 +6,8 @@ Mailman has an NNTP gateway, whereby messages posted to the mailing list can be forwarded onto an NNTP newsgroup. Typically this means Usenet, but since NNTP is to Usenet as IP is to the web, it's more general than that. - >>> handler = config.handlers['to-usenet'] - >>> mlist = config.db.list_manager.create('_xtest@example.com') - >>> mlist.preferred_language = 'en' - >>> switchboard = config.switchboards['news'] + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') Gatewaying from the mailing list to the newsgroup happens through a separate 'nntp' queue and happen immediately when the message is posted through to the @@ -25,7 +23,11 @@ the newsgroup. The feature could be disabled, as is the default. ... ... Something of great import. ... """) + + >>> handler = config.handlers['to-usenet'] >>> handler.process(mlist, msg, {}) + + >>> switchboard = config.switchboards['news'] >>> switchboard.files [] diff --git a/src/mailman/pipeline/docs/reply-to.txt b/src/mailman/pipeline/docs/reply-to.txt index 2652753d6..18b821d7f 100644 --- a/src/mailman/pipeline/docs/reply-to.txt +++ b/src/mailman/pipeline/docs/reply-to.txt @@ -8,9 +8,8 @@ transformations. Some headers get added, others get changed. Some of these changes depend on mailing list settings and others depend on how the message is getting sent through the system. We'll take things one-by-one. - >>> from mailman.pipeline.cook_headers import process - >>> mlist = config.db.list_manager.create('_xtest@example.com') - >>> mlist.subject_prefix = '' + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') Reply-to munging refers to the behavior where a mailing list can be configured to change or augment an existing Reply-To header in a message posted to the @@ -45,6 +44,8 @@ message, the list's posting address simply gets inserted. ... From: aperson@example.com ... ... """) + + >>> from mailman.pipeline.cook_headers import process >>> process(mlist, msg, {}) >>> len(msg.get_all('reply-to')) 1 diff --git a/src/mailman/pipeline/docs/scrubber.txt b/src/mailman/pipeline/docs/scrubber.txt index 8bc33aa13..446843f51 100644 --- a/src/mailman/pipeline/docs/scrubber.txt +++ b/src/mailman/pipeline/docs/scrubber.txt @@ -7,8 +7,8 @@ messages and in components such as the archiver. Its primary purpose is to scrub attachments from messages so that binary goop doesn't end up in an archive message. - >>> from mailman.pipeline.scrubber import process, save_attachment - >>> mlist = config.db.list_manager.create('_xtest@example.com') + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') >>> mlist.preferred_language = 'en' Helper functions for getting the attachment data. @@ -41,7 +41,7 @@ Helper functions for getting the attachment data. Saving attachments ================== -The Scrubber handler exposes a function called save_attachments() which can be +The Scrubber handler exposes a function called save_attachment() which can be used to strip various types of attachments and store them in the archive directory. This is a public interface used by components outside the normal processing pipeline. @@ -62,6 +62,8 @@ this is an unfortunate double negative). ... ... R0lGODdhAQABAIAAAAAAAAAAACwAAAAAAQABAAACAQUAOw== ... """) + + >>> from mailman.pipeline.scrubber import save_attachment >>> print save_attachment(mlist, msg, 'dir') <http://www.example.com/pipermail/_xtest@example.com/dir/xtest.gif> >>> data = read_attachment('dir/xtest.gif') @@ -134,6 +136,7 @@ a reference to the attachment file as available through the on-line archive. The Scrubber.process() function is different than other handler process functions in that it returns the scrubbed message. + >>> from mailman.pipeline.scrubber import process >>> scrubbed_msg = process(mlist, msg, msgdata) >>> scrubbed_msg is msg True diff --git a/src/mailman/pipeline/docs/subject-munging.txt b/src/mailman/pipeline/docs/subject-munging.txt index 68ad940e8..e7f55add6 100644 --- a/src/mailman/pipeline/docs/subject-munging.txt +++ b/src/mailman/pipeline/docs/subject-munging.txt @@ -8,9 +8,8 @@ transformations. Some headers get added, others get changed. Some of these changes depend on mailing list settings and others depend on how the message is getting sent through the system. We'll take things one-by-one. - >>> from mailman.pipeline.cook_headers import process - >>> mlist = config.db.list_manager.create('_xtest@example.com') - >>> mlist.subject_prefix = '' + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') Inserting a prefix @@ -29,6 +28,8 @@ munging, a mailing list must have a preferred language. ... A message of great import. ... """) >>> msgdata = {} + + >>> from mailman.pipeline.cook_headers import process >>> process(mlist, msg, msgdata) The original subject header is stored in the message metadata. We must print diff --git a/src/mailman/pipeline/docs/tagger.txt b/src/mailman/pipeline/docs/tagger.txt index a552401f7..46cdedcb7 100644 --- a/src/mailman/pipeline/docs/tagger.txt +++ b/src/mailman/pipeline/docs/tagger.txt @@ -9,8 +9,8 @@ double duty as the 'topic tag'. Each message that flows the mailing list has its Subject: and Keywords: headers compared against these regular expressions. The message then gets tagged with the topic names of each hit. - >>> from mailman.pipeline.tagger import process - >>> mlist = config.db.list_manager.create('_xtest@example.com') + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') Topics must be enabled for Mailman to do any topic matching, even if topics are defined. @@ -25,6 +25,8 @@ are defined. ... ... """) >>> msgdata = {} + + >>> from mailman.pipeline.tagger import process >>> process(mlist, msg, msgdata) >>> print msg.as_string() Subject: foobar diff --git a/src/mailman/pipeline/docs/to-outgoing.txt b/src/mailman/pipeline/docs/to-outgoing.txt index 9d467bb5e..a8e67ec9f 100644 --- a/src/mailman/pipeline/docs/to-outgoing.txt +++ b/src/mailman/pipeline/docs/to-outgoing.txt @@ -10,10 +10,10 @@ term somewhat incorrectly, but within the spirit of the standard, which basically describes how to encode the recipient's address in the originator headers for unambigous bounce processing. - >>> handler = config.handlers['to-outgoing'] - >>> mlist = config.db.list_manager.create('_xtest@example.com') - >>> switchboard = config.switchboards['out'] + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list('_xtest@example.com') + >>> switchboard = config.switchboards['out'] >>> def queue_size(): ... size = len(switchboard.files) ... for filebase in switchboard.files: @@ -34,6 +34,8 @@ When certain conditions are met, the message will be VERP'd. For example, if the message metadata already has a VERP key, this message will be VERP'd. >>> msgdata = dict(foo=1, bar=2, verp=True) + + >>> handler = config.handlers['to-outgoing'] >>> handler.process(mlist, msg, msgdata) >>> print msg.as_string() Subject: Here is a message |
