summaryrefslogtreecommitdiff
path: root/Mailman/docs/avoid-duplicates.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Mailman/docs/avoid-duplicates.txt')
-rw-r--r--Mailman/docs/avoid-duplicates.txt40
1 files changed, 17 insertions, 23 deletions
diff --git a/Mailman/docs/avoid-duplicates.txt b/Mailman/docs/avoid-duplicates.txt
index b14bdb5bf..6a1b46f77 100644
--- a/Mailman/docs/avoid-duplicates.txt
+++ b/Mailman/docs/avoid-duplicates.txt
@@ -6,27 +6,22 @@ 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.
- >>> from email import message_from_string
- >>> from Mailman.Message import Message
>>> from Mailman.Handlers.AvoidDuplicates import process
>>> from Mailman.configuration import config
- >>> from Mailman.database import flush
- >>> mlist = config.db.list_manager.create('_xtest@example.com')
- >>> flush()
+ >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
Create some members we're going to use.
>>> from Mailman.interfaces import MemberRole
>>> address_a = config.db.user_manager.create_address(
- ... 'aperson@example.com')
+ ... u'aperson@example.com')
>>> address_b = config.db.user_manager.create_address(
- ... 'bperson@example.com')
+ ... u'bperson@example.com')
>>> member_a = address_a.subscribe(mlist, MemberRole.member)
>>> member_b = address_b.subscribe(mlist, MemberRole.member)
- >>> flush()
>>> # This is the message metadata dictionary as it would be produced by
>>> # the CalcRecips handler.
- >>> recips = dict(recips=['aperson@example.com', 'bperson@example.com'])
+ >>> recips = dict(recips=[u'aperson@example.com', u'bperson@example.com'])
Short circuiting
@@ -39,7 +34,7 @@ The module short-circuits if there are no recipients.
... Subject: A message of great import
...
... Something
- ... """, Message)
+ ... """)
>>> msgdata = {}
>>> process(mlist, msg, msgdata)
>>> msgdata
@@ -62,16 +57,15 @@ one of the recipient headers (i.e. To, CC, Resent-To, or Resent-CC), then they
will get a list copy.
>>> member_a.preferences.receive_list_copy = False
- >>> flush()
>>> msg = message_from_string("""\
... From: Claire Person <cperson@example.com>
...
... Something of great import.
- ... """, Message)
+ ... """)
>>> msgdata = recips.copy()
>>> process(mlist, msg, msgdata)
>>> sorted(msgdata['recips'])
- ['aperson@example.com', 'bperson@example.com']
+ [u'aperson@example.com', u'bperson@example.com']
>>> print msg.as_string()
From: Claire Person <cperson@example.com>
<BLANKLINE>
@@ -85,11 +79,11 @@ If they're mentioned on the CC line, they won't get a list copy.
... CC: aperson@example.com
...
... Something of great import.
- ... """, Message)
+ ... """)
>>> msgdata = recips.copy()
>>> process(mlist, msg, msgdata)
>>> sorted(msgdata['recips'])
- ['bperson@example.com']
+ [u'bperson@example.com']
>>> print msg.as_string()
From: Claire Person <cperson@example.com>
CC: aperson@example.com
@@ -105,11 +99,11 @@ But if they're mentioned on the CC line and have receive_list_copy set to True
... CC: bperson@example.com
...
... Something of great import.
- ... """, Message)
+ ... """)
>>> msgdata = recips.copy()
>>> process(mlist, msg, msgdata)
>>> sorted(msgdata['recips'])
- ['aperson@example.com', 'bperson@example.com']
+ [u'aperson@example.com', u'bperson@example.com']
>>> print msg.as_string()
From: Claire Person <cperson@example.com>
CC: bperson@example.com
@@ -124,11 +118,11 @@ Other headers checked for recipients include the To...
... To: aperson@example.com
...
... Something of great import.
- ... """, Message)
+ ... """)
>>> msgdata = recips.copy()
>>> process(mlist, msg, msgdata)
>>> sorted(msgdata['recips'])
- ['bperson@example.com']
+ [u'bperson@example.com']
>>> print msg.as_string()
From: Claire Person <cperson@example.com>
To: aperson@example.com
@@ -143,11 +137,11 @@ Other headers checked for recipients include the To...
... Resent-To: aperson@example.com
...
... Something of great import.
- ... """, Message)
+ ... """)
>>> msgdata = recips.copy()
>>> process(mlist, msg, msgdata)
>>> sorted(msgdata['recips'])
- ['bperson@example.com']
+ [u'bperson@example.com']
>>> print msg.as_string()
From: Claire Person <cperson@example.com>
Resent-To: aperson@example.com
@@ -162,11 +156,11 @@ Other headers checked for recipients include the To...
... Resent-Cc: aperson@example.com
...
... Something of great import.
- ... """, Message)
+ ... """)
>>> msgdata = recips.copy()
>>> process(mlist, msg, msgdata)
>>> sorted(msgdata['recips'])
- ['bperson@example.com']
+ [u'bperson@example.com']
>>> print msg.as_string()
From: Claire Person <cperson@example.com>
Resent-Cc: aperson@example.com