summaryrefslogtreecommitdiff
path: root/mailman/pipeline/docs/file-recips.txt
diff options
context:
space:
mode:
authorBarry Warsaw2009-01-25 13:01:41 -0500
committerBarry Warsaw2009-01-25 13:01:41 -0500
commiteefd06f1b88b8ecbb23a9013cd223b72ca85c20d (patch)
tree72c947fe16fce0e07e996ee74020b26585d7e846 /mailman/pipeline/docs/file-recips.txt
parent07871212f74498abd56bef3919bf3e029eb8b930 (diff)
downloadmailman-eefd06f1b88b8ecbb23a9013cd223b72ca85c20d.tar.gz
mailman-eefd06f1b88b8ecbb23a9013cd223b72ca85c20d.tar.zst
mailman-eefd06f1b88b8ecbb23a9013cd223b72ca85c20d.zip
Diffstat (limited to 'mailman/pipeline/docs/file-recips.txt')
-rw-r--r--mailman/pipeline/docs/file-recips.txt96
1 files changed, 0 insertions, 96 deletions
diff --git a/mailman/pipeline/docs/file-recips.txt b/mailman/pipeline/docs/file-recips.txt
deleted file mode 100644
index 81510b6e7..000000000
--- a/mailman/pipeline/docs/file-recips.txt
+++ /dev/null
@@ -1,96 +0,0 @@
-File recipients
-===============
-
-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(u'_xtest@example.com')
-
-
-Short circuiting
-----------------
-
-If the message's metadata already has recipients, this handler immediately
-returns.
-
- >>> msg = message_from_string("""\
- ... From: aperson@example.com
- ...
- ... A message.
- ... """)
- >>> msgdata = {'recips': 7}
- >>> handler.process(mlist, msg, msgdata)
- >>> print msg.as_string()
- From: aperson@example.com
- <BLANKLINE>
- A message.
- <BLANKLINE>
- >>> msgdata
- {'recips': 7}
-
-
-Missing file
-------------
-
-The include file must live inside the list's data directory, under the name
-members.txt. If the file doesn't exist, the list of recipients will be
-empty.
-
- >>> import os
- >>> file_path = os.path.join(mlist.data_path, 'members.txt')
- >>> open(file_path)
- Traceback (most recent call last):
- ...
- IOError: [Errno ...]
- No such file or directory: u'.../_xtest@example.com/members.txt'
- >>> msgdata = {}
- >>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
- []
-
-
-Existing file
--------------
-
-If the file exists, it contains a list of addresses, one per line. These
-addresses are returned as the set of recipients.
-
- >>> fp = open(file_path, 'w')
- >>> try:
- ... print >> fp, 'bperson@example.com'
- ... print >> fp, 'cperson@example.com'
- ... print >> fp, 'dperson@example.com'
- ... print >> fp, 'eperson@example.com'
- ... print >> fp, 'fperson@example.com'
- ... print >> fp, 'gperson@example.com'
- ... finally:
- ... fp.close()
-
- >>> msgdata = {}
- >>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
- ['bperson@example.com', 'cperson@example.com', 'dperson@example.com',
- 'eperson@example.com', 'fperson@example.com', 'gperson@example.com']
-
-However, if the sender of the original message is a member of the list and
-their address is in the include file, the sender's address is /not/ included
-in the recipients list.
-
- >>> from mailman.interfaces.member import MemberRole
- >>> address_1 = config.db.user_manager.create_address(
- ... u'cperson@example.com')
- >>> address_1.subscribe(mlist, MemberRole.member)
- <Member: cperson@example.com on _xtest@example.com as MemberRole.member>
-
- >>> msg = message_from_string("""\
- ... From: cperson@example.com
- ...
- ... A message.
- ... """)
- >>> msgdata = {}
- >>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
- ['bperson@example.com', 'dperson@example.com',
- 'eperson@example.com', 'fperson@example.com', 'gperson@example.com']