← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/testfix-bug-footer into lp:launchpad.

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

Requested reviews:
  Colin Watson (cjwatson)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/testfix-bug-footer/+merge/266747

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.
-- 
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/bugs/subscribers/bug.py'
--- lib/lp/bugs/subscribers/bug.py	2015-07-31 14:46:31 +0000
+++ lib/lp/bugs/subscribers/bug.py	2015-08-03 15:58:47 +0000
@@ -16,6 +16,8 @@
 
 import datetime
 
+from zope.security.proxy import removeSecurityProxy
+
 from lp.bugs.adapters.bugchange import (
     BugDuplicateChange,
     BugTaskAssigneeChange,
@@ -226,7 +228,8 @@
 
     bug_notification_builder = BugNotificationBuilder(bug, event_creator)
     for to_person in sorted(to_persons):
-        reason, rationale = recipients.getReason(to_person)
+        reason, rationale = recipients.getReason(
+            str(removeSecurityProxy(to_person).preferredemail.email))
         subject, contents = generate_bug_add_email(
             bug, new_recipients=True, subscribed_by=subscribed_by,
             reason=reason, event_creator=event_creator)


References