summaryrefslogtreecommitdiff
path: root/src/mailman/pipeline
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/pipeline')
-rw-r--r--src/mailman/pipeline/avoid_duplicates.py4
-rw-r--r--src/mailman/pipeline/calculate_recipients.py38
-rw-r--r--src/mailman/pipeline/decorate.py7
-rw-r--r--src/mailman/pipeline/docs/acknowledge.txt4
-rw-r--r--src/mailman/pipeline/docs/avoid-duplicates.txt15
-rw-r--r--src/mailman/pipeline/docs/calc-recips.txt10
-rw-r--r--src/mailman/pipeline/docs/decorate.txt21
-rw-r--r--src/mailman/pipeline/docs/file-recips.txt10
-rw-r--r--src/mailman/pipeline/docs/replybot.txt4
-rw-r--r--src/mailman/pipeline/file_recipients.py6
-rw-r--r--src/mailman/pipeline/owner_recipients.py2
11 files changed, 49 insertions, 72 deletions
diff --git a/src/mailman/pipeline/avoid_duplicates.py b/src/mailman/pipeline/avoid_duplicates.py
index 0458e117c..840d5f8b2 100644
--- a/src/mailman/pipeline/avoid_duplicates.py
+++ b/src/mailman/pipeline/avoid_duplicates.py
@@ -52,7 +52,7 @@ class AvoidDuplicates:
def process(self, mlist, msg, msgdata):
"""See `IHandler`."""
- recips = msgdata.get('recips')
+ recips = msgdata.get('recipients')
# Short circuit
if not recips:
return
@@ -109,7 +109,7 @@ class AvoidDuplicates:
# having received this message.
newrecips.add(r)
# Set the new list of recipients. XXX recips should always be a set.
- msgdata['recips'] = list(newrecips)
+ msgdata['recipients'] = list(newrecips)
# RFC 2822 specifies zero or one CC header
if cc_addresses:
del msg['cc']
diff --git a/src/mailman/pipeline/calculate_recipients.py b/src/mailman/pipeline/calculate_recipients.py
index 0850db929..ccbc069d1 100644
--- a/src/mailman/pipeline/calculate_recipients.py
+++ b/src/mailman/pipeline/calculate_recipients.py
@@ -19,7 +19,7 @@
This module calculates the non-digest recipients for the message based on the
list's membership and configuration options. It places the list of recipients
-on the `recips' attribute of the message. This attribute is used by the
+on the `recipients' attribute of the message. This attribute is used by the
SendmailDeliver and BulkDeliver modules.
"""
@@ -52,7 +52,7 @@ class CalculateRecipients:
def process(self, mlist, msg, msgdata):
# Short circuit if we've already calculated the recipients list,
# regardless of whether the list is empty or not.
- if 'recips' in msgdata:
+ if 'recipients' in msgdata:
return
# Should the original sender should be included in the recipients list?
include_sender = True
@@ -72,10 +72,10 @@ class CalculateRecipients:
if mlist.Authenticate((config.AuthListModerator,
config.AuthListAdmin),
password):
- recips = mlist.getMemberCPAddresses(
+ recipients = mlist.getMemberCPAddresses(
mlist.getRegularMemberKeys() +
mlist.getDigestMemberKeys())
- msgdata['recips'] = recips
+ msgdata['recipients'] = recipients
return
else:
# Bad Urgent: password, so reject it instead of passing it on.
@@ -88,30 +88,30 @@ delivery. The original message as received by Mailman is attached.
""")
raise errors.RejectMessage(Utils.wrap(text))
# Calculate the regular recipients of the message
- recips = set(member.address.address
- for member in mlist.regular_members.members
- if member.delivery_status == DeliveryStatus.enabled)
+ recipients = set(member.address.address
+ for member in mlist.regular_members.members
+ if member.delivery_status == DeliveryStatus.enabled)
# Remove the sender if they don't want to receive their own posts
- if not include_sender and member.address.address in recips:
- recips.remove(member.address.address)
+ if not include_sender and member.address.address in recipients:
+ recipients.remove(member.address.address)
# Handle topic classifications
- do_topic_filters(mlist, msg, msgdata, recips)
+ do_topic_filters(mlist, msg, msgdata, recipients)
# Bookkeeping
- msgdata['recips'] = recips
+ msgdata['recipients'] = recipients
-def do_topic_filters(mlist, msg, msgdata, recips):
+def do_topic_filters(mlist, msg, msgdata, recipients):
if not mlist.topics_enabled:
# MAS: if topics are currently disabled for the list, send to all
# regardless of ReceiveNonmatchingTopics
return
hits = msgdata.get('topichits')
- zaprecips = []
+ zap_recipients = []
if hits:
# The message hit some topics, so only deliver this message to those
# who are interested in one of the hit topics.
- for user in recips:
+ for user in recipients:
utopics = mlist.getMemberTopics(user)
if not utopics:
# This user is not interested in any topics, so they get all
@@ -125,13 +125,13 @@ def do_topic_filters(mlist, msg, msgdata, recips):
else:
# The user was interested in topics, but not any of the ones
# this message matched, so zap him.
- zaprecips.append(user)
+ zap_recipients.append(user)
else:
# The semantics for a message that did not hit any of the pre-canned
# topics is to troll through the membership list, looking for users
# who selected at least one topic of interest, but turned on
# ReceiveNonmatchingTopics.
- for user in recips:
+ for user in recipients:
if not mlist.getMemberTopics(user):
# The user did not select any topics of interest, so he gets
# this message by default.
@@ -140,8 +140,8 @@ def do_topic_filters(mlist, msg, msgdata, recips):
user, config.ReceiveNonmatchingTopics):
# The user has interest in some topics, but elects not to
# receive message that match no topics, so zap him.
- zaprecips.append(user)
+ zap_recipients.append(user)
# Otherwise, the user wants non-matching messages.
# Prune out the non-receiving users
- for user in zaprecips:
- recips.remove(user)
+ for user in zap_recipients:
+ recipients.remove(user)
diff --git a/src/mailman/pipeline/decorate.py b/src/mailman/pipeline/decorate.py
index c6b613fda..f9e41e177 100644
--- a/src/mailman/pipeline/decorate.py
+++ b/src/mailman/pipeline/decorate.py
@@ -52,10 +52,7 @@ def process(mlist, msg, msgdata):
if msgdata.get('personalize'):
# Calculate the extra personalization dictionary. Note that the
# length of the recips list better be exactly 1.
- recips = msgdata.get('recips', [])
- assert len(recips) == 1, (
- 'The number of intended recipients must be exactly 1')
- recipient = recips[0].lower()
+ recipient = msgdata['recipient']
user = getUtility(IUserManager).get_user(recipient)
member = mlist.members.get_member(recipient)
d['user_address'] = recipient
@@ -63,7 +60,7 @@ def process(mlist, msg, msgdata):
d['user_delivered_to'] = member.address.original_address
# BAW: Hmm, should we allow this?
d['user_password'] = user.password
- d['user_language'] = member.preferred_language
+ d['user_language'] = member.preferred_language.description
d['user_name'] = (user.real_name if user.real_name
else member.address.original_address)
d['user_optionsurl'] = member.options_url
diff --git a/src/mailman/pipeline/docs/acknowledge.txt b/src/mailman/pipeline/docs/acknowledge.txt
index 3b8316cab..c304bd8bf 100644
--- a/src/mailman/pipeline/docs/acknowledge.txt
+++ b/src/mailman/pipeline/docs/acknowledge.txt
@@ -110,7 +110,7 @@ The receipt will include the original message's subject in the response body,
>>> virginq.files
[]
>>> sorted(qdata.items())
- [..., ('recips', [u'aperson@example.com']), ...]
+ [..., ('recipients', [u'aperson@example.com']), ...]
>>> print qmsg.as_string()
...
MIME-Version: 1.0
@@ -144,7 +144,7 @@ If there is no subject, then the receipt will use a generic message.
>>> virginq.files
[]
>>> sorted(qdata.items())
- [..., ('recips', [u'aperson@example.com']), ...]
+ [..., ('recipients', [u'aperson@example.com']), ...]
>>> print qmsg.as_string()
MIME-Version: 1.0
...
diff --git a/src/mailman/pipeline/docs/avoid-duplicates.txt b/src/mailman/pipeline/docs/avoid-duplicates.txt
index 9b44d0ebe..1493c4d04 100644
--- a/src/mailman/pipeline/docs/avoid-duplicates.txt
+++ b/src/mailman/pipeline/docs/avoid-duplicates.txt
@@ -24,7 +24,8 @@ Create some members we're going to use.
>>> member_b = address_b.subscribe(mlist, MemberRole.member)
>>> # 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(
+ ... recipients=['aperson@example.com', 'bperson@example.com'])
Short circuiting
@@ -69,7 +70,7 @@ will get a list copy.
... """)
>>> msgdata = recips.copy()
>>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
+ >>> sorted(msgdata['recipients'])
[u'aperson@example.com', u'bperson@example.com']
>>> print msg.as_string()
From: Claire Person <cperson@example.com>
@@ -87,7 +88,7 @@ If they're mentioned on the CC line, they won't get a list copy.
... """)
>>> msgdata = recips.copy()
>>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
+ >>> sorted(msgdata['recipients'])
[u'bperson@example.com']
>>> print msg.as_string()
From: Claire Person <cperson@example.com>
@@ -107,7 +108,7 @@ But if they're mentioned on the CC line and have receive_list_copy set to True
... """)
>>> msgdata = recips.copy()
>>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
+ >>> sorted(msgdata['recipients'])
[u'aperson@example.com', u'bperson@example.com']
>>> print msg.as_string()
From: Claire Person <cperson@example.com>
@@ -126,7 +127,7 @@ Other headers checked for recipients include the To...
... """)
>>> msgdata = recips.copy()
>>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
+ >>> sorted(msgdata['recipients'])
[u'bperson@example.com']
>>> print msg.as_string()
From: Claire Person <cperson@example.com>
@@ -145,7 +146,7 @@ Other headers checked for recipients include the To...
... """)
>>> msgdata = recips.copy()
>>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
+ >>> sorted(msgdata['recipients'])
[u'bperson@example.com']
>>> print msg.as_string()
From: Claire Person <cperson@example.com>
@@ -164,7 +165,7 @@ Other headers checked for recipients include the To...
... """)
>>> msgdata = recips.copy()
>>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
+ >>> sorted(msgdata['recipients'])
[u'bperson@example.com']
>>> print msg.as_string()
From: Claire Person <cperson@example.com>
diff --git a/src/mailman/pipeline/docs/calc-recips.txt b/src/mailman/pipeline/docs/calc-recips.txt
index ef8c0e2b7..0821aa1a9 100644
--- a/src/mailman/pipeline/docs/calc-recips.txt
+++ b/src/mailman/pipeline/docs/calc-recips.txt
@@ -53,12 +53,12 @@ but not all of the recipients.
...
... Something of great import.
... """)
- >>> recips = set(('qperson@example.com', 'zperson@example.com'))
- >>> msgdata = dict(recips=recips)
+ >>> recipients = set(('qperson@example.com', 'zperson@example.com'))
+ >>> msgdata = dict(recipients=recipients)
>>> handler = config.handlers['calculate-recipients']
>>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
+ >>> sorted(msgdata['recipients'])
[u'qperson@example.com', u'zperson@example.com']
@@ -70,7 +70,7 @@ soon as they are posted. In other words, these folks are not digest members.
>>> msgdata = {}
>>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
+ >>> sorted(msgdata['recipients'])
[u'aperson@example.com', u'bperson@example.com', u'cperson@example.com']
Members can elect not to receive a list copy of their own postings.
@@ -83,7 +83,7 @@ Members can elect not to receive a list copy of their own postings.
... """)
>>> msgdata = {}
>>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
+ >>> sorted(msgdata['recipients'])
[u'aperson@example.com', u'bperson@example.com']
Members can also elect not to receive a list copy of any message on which they
diff --git a/src/mailman/pipeline/docs/decorate.txt b/src/mailman/pipeline/docs/decorate.txt
index 42afe9a80..246e67096 100644
--- a/src/mailman/pipeline/docs/decorate.txt
+++ b/src/mailman/pipeline/docs/decorate.txt
@@ -295,24 +295,3 @@ that the header and footer can be added as attachments.
<BLANKLINE>
footer
--BOUNDARY--
-
-
-Personalization
-===============
-
-A mailing list can be 'personalized', meaning that each message is unique for
-each recipient. When the list is personalized, additional interpolation
-variables are available, however the list of intended recipients must be
-provided in the message data, otherwise an exception occurs.
-
- >>> process(mlist, None, dict(personalize=True))
- Traceback (most recent call last):
- ...
- AssertionError: The number of intended recipients must be exactly 1
-
-And the number of intended recipients must be exactly 1.
-
- >>> process(mlist, None, dict(personalize=True, recips=[1, 2, 3]))
- Traceback (most recent call last):
- ...
- AssertionError: The number of intended recipients must be exactly 1
diff --git a/src/mailman/pipeline/docs/file-recips.txt b/src/mailman/pipeline/docs/file-recips.txt
index 3401e7492..b84b2181d 100644
--- a/src/mailman/pipeline/docs/file-recips.txt
+++ b/src/mailman/pipeline/docs/file-recips.txt
@@ -21,7 +21,7 @@ returns.
...
... A message.
... """)
- >>> msgdata = {'recips': 7}
+ >>> msgdata = {'recipients': 7}
>>> handler = config.handlers['file-recipients']
>>> handler.process(mlist, msg, msgdata)
@@ -31,7 +31,7 @@ returns.
A message.
<BLANKLINE>
>>> msgdata
- {u'recips': 7}
+ {u'recipients': 7}
Missing file
@@ -50,7 +50,7 @@ empty.
No such file or directory: u'.../_xtest@example.com/members.txt'
>>> msgdata = {}
>>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
+ >>> sorted(msgdata['recipients'])
[]
@@ -73,7 +73,7 @@ addresses are returned as the set of recipients.
>>> msgdata = {}
>>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
+ >>> sorted(msgdata['recipients'])
['bperson@example.com', 'cperson@example.com', 'dperson@example.com',
'eperson@example.com', 'fperson@example.com', 'gperson@example.com']
@@ -97,6 +97,6 @@ in the recipients list.
... """)
>>> msgdata = {}
>>> handler.process(mlist, msg, msgdata)
- >>> sorted(msgdata['recips'])
+ >>> sorted(msgdata['recipients'])
['bperson@example.com', 'dperson@example.com',
'eperson@example.com', 'fperson@example.com', 'gperson@example.com']
diff --git a/src/mailman/pipeline/docs/replybot.txt b/src/mailman/pipeline/docs/replybot.txt
index 36bc6198f..f02b90254 100644
--- a/src/mailman/pipeline/docs/replybot.txt
+++ b/src/mailman/pipeline/docs/replybot.txt
@@ -49,7 +49,7 @@ response.
_parsemsg : False
listname : _xtest@example.com
nodecorate : True
- recips : [u'aperson@example.com']
+ recipients : [u'aperson@example.com']
reduced_list_headers: True
version : 3
@@ -137,7 +137,7 @@ header is ignored.
_parsemsg : False
listname : _xtest@example.com
nodecorate : True
- recips : [u'asystem@example.com']
+ recipients : [u'asystem@example.com']
reduced_list_headers: True
version : 3
diff --git a/src/mailman/pipeline/file_recipients.py b/src/mailman/pipeline/file_recipients.py
index fd2db596a..c3d995a9c 100644
--- a/src/mailman/pipeline/file_recipients.py
+++ b/src/mailman/pipeline/file_recipients.py
@@ -45,7 +45,7 @@ class FileRecipients:
def process(self, mlist, msg, msgdata):
"""See `IHandler`."""
- if 'recips' in msgdata:
+ if 'recipients' in msgdata:
return
filename = os.path.join(mlist.data_path, 'members.txt')
try:
@@ -54,11 +54,11 @@ class FileRecipients:
except IOError, e:
if e.errno <> errno.ENOENT:
raise
- msgdata['recips'] = set()
+ msgdata['recipients'] = set()
return
# If the sender is a member of the list, remove them from the file
# recipients.
member = mlist.members.get_member(msg.sender)
if member is not None:
addrs.discard(member.address.address)
- msgdata['recips'] = addrs
+ msgdata['recipients'] = addrs
diff --git a/src/mailman/pipeline/owner_recipients.py b/src/mailman/pipeline/owner_recipients.py
index ceb6ae0a1..ca6c17bd9 100644
--- a/src/mailman/pipeline/owner_recipients.py
+++ b/src/mailman/pipeline/owner_recipients.py
@@ -28,7 +28,7 @@ __all__ = [
def process(mlist, msg, msgdata):
# The recipients are the owner and the moderator
- msgdata['recips'] = mlist.owner + mlist.moderator
+ msgdata['recipients'] = mlist.owner + mlist.moderator
# Don't decorate these messages with the header/footers
msgdata['nodecorate'] = True
msgdata['personalize'] = False