Merge lp:~cjwatson/launchpad/testfix-bug-footer into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 17669
Proposed branch: lp:~cjwatson/launchpad/testfix-bug-footer
Merge into: lp:launchpad
Diff against target: 22 lines (+4/-1)
1 file modified
lib/lp/bugs/subscribers/bug.py (+4/-1)
To merge this branch: bzr merge lp:~cjwatson/launchpad/testfix-bug-footer
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+266747@code.launchpad.net

Commit message

Pass an email address to BugNotificationRecipients.getReason, not a Person.

Description of the change

Pass an email address to BugNotificationRecipients.getReason, not a Person.

The semantics of NotificationRecipientSet are a bit weird. It looks like you can freely pass a Person or an email address, but they aren't actually interchangeable here when teams are involved, which caused several doctests to fail.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/subscribers/bug.py'
2--- lib/lp/bugs/subscribers/bug.py 2015-07-31 14:46:31 +0000
3+++ lib/lp/bugs/subscribers/bug.py 2015-08-03 15:58:47 +0000
4@@ -16,6 +16,8 @@
5
6 import datetime
7
8+from zope.security.proxy import removeSecurityProxy
9+
10 from lp.bugs.adapters.bugchange import (
11 BugDuplicateChange,
12 BugTaskAssigneeChange,
13@@ -226,7 +228,8 @@
14
15 bug_notification_builder = BugNotificationBuilder(bug, event_creator)
16 for to_person in sorted(to_persons):
17- reason, rationale = recipients.getReason(to_person)
18+ reason, rationale = recipients.getReason(
19+ str(removeSecurityProxy(to_person).preferredemail.email))
20 subject, contents = generate_bug_add_email(
21 bug, new_recipients=True, subscribed_by=subscribed_by,
22 reason=reason, event_creator=event_creator)