diff options
| author | Barry Warsaw | 2012-03-05 12:58:20 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2012-03-05 12:58:20 -0500 |
| commit | f4b98f8b8e8b9fdcab8c352019f09b1469c93b24 (patch) | |
| tree | 8a43643beb240ca299ffb379df8e90567b44305c /src/mailman/pipeline | |
| parent | 40347db84550a85f43e6befa4641693200d30509 (diff) | |
| download | mailman-f4b98f8b8e8b9fdcab8c352019f09b1469c93b24.tar.gz mailman-f4b98f8b8e8b9fdcab8c352019f09b1469c93b24.tar.zst mailman-f4b98f8b8e8b9fdcab8c352019f09b1469c93b24.zip | |
Fix header/footer interpolations when personalizing messages.
- When doing individual deliveries, insert a 'member' key into the copy of the
metadata dictionary for this recipient's delivery. This will contain the
IMember of the recipient, if the recipient is a member of the mailing list.
There will still be a 'recipient' key which will contain just the email
address to deliver the message to.
- Remove $user_password from header/footer placeholders.
- Remove the 'personalize' key from the metadata dictionary and change
decorate.process() to search only for the 'member' key. No need for both of
them and the 'member' key contains more information. Plus, it allows us to
do a more efficient member query in the delivery module some time in the
future.
- Move some of the LMTP log messages from mailman.runner to mailman.smtp.
Diffstat (limited to 'src/mailman/pipeline')
| -rw-r--r-- | src/mailman/pipeline/decorate.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/mailman/pipeline/decorate.py b/src/mailman/pipeline/decorate.py index a8fc340f8..b785e5ecf 100644 --- a/src/mailman/pipeline/decorate.py +++ b/src/mailman/pipeline/decorate.py @@ -51,21 +51,16 @@ def process(mlist, msg, msgdata): if msgdata.get('isdigest') or msgdata.get('nodecorate'): return d = {} - if msgdata.get('personalize'): - # Calculate the extra personalization dictionary. Note that the - # length of the recips list better be exactly 1. - recipient = msgdata['recipient'] - user = getUtility(IUserManager).get_user(recipient) - member = mlist.members.get_member(recipient) + member = msgdata.get('member') + if member is not None: + # Calculate the extra personalization dictionary. + recipient = msgdata.get('recipient', member.address.original_email) d['user_address'] = recipient - if user is not None and member is not None: - d['user_delivered_to'] = member.address.original_email - # BAW: Hmm, should we allow this? - d['user_password'] = user.password - d['user_language'] = member.preferred_language.description - d['user_name'] = (user.real_name if user.real_name - else member.address.original_email) - d['user_optionsurl'] = member.options_url + d['user_delivered_to'] = member.address.original_email + d['user_language'] = member.preferred_language.description + d['user_name'] = (member.user.real_name if member.user.real_name + else member.address.original_email) + d['user_optionsurl'] = member.options_url # These strings are descriptive for the log file and shouldn't be i18n'd d.update(msgdata.get('decoration-data', {})) try: |
