Merge lp:~cjwatson/launchpad/copy-errors-to-sponsored into lp:launchpad

Proposed by Colin Watson
Status: Merged
Approved by: William Grant
Approved revision: no longer in the source branch.
Merged at revision: 17009
Proposed branch: lp:~cjwatson/launchpad/copy-errors-to-sponsored
Merge into: lp:launchpad
Diff against target: 45 lines (+13/-3)
2 files modified
lib/lp/soyuz/model/packagecopyjob.py (+5/-2)
lib/lp/soyuz/tests/test_packagecopyjob.py (+8/-1)
To merge this branch: bzr merge lp:~cjwatson/launchpad/copy-errors-to-sponsored
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+219666@code.launchpad.net

Commit message

Send notification of PCJ errors to the sponsored person, if any.

Description of the change

If there is a sponsored person listed in a PCJ, add them to the list of people notified on errors. Fixes the Launchpad part of bug 1319704.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/model/packagecopyjob.py'
2--- lib/lp/soyuz/model/packagecopyjob.py 2013-07-16 14:06:08 +0000
3+++ lib/lp/soyuz/model/packagecopyjob.py 2014-05-15 09:40:47 +0000
4@@ -1,4 +1,4 @@
5-# Copyright 2010-2013 Canonical Ltd. This software is licensed under the
6+# Copyright 2010-2014 Canonical Ltd. This software is licensed under the
7 # GNU Affero General Public License version 3 (see the file LICENSE).
8
9 __metaclass__ = type
10@@ -246,7 +246,10 @@
11
12 def getErrorRecipients(self):
13 """See `IPlainPackageCopyJob`."""
14- return [format_address_for_person(self.requester)]
15+ recipients = [self.requester]
16+ if self.sponsored is not None:
17+ recipients.append(self.sponsored)
18+ return [format_address_for_person(person) for person in recipients]
19
20 @property
21 def copy_policy(self):
22
23=== modified file 'lib/lp/soyuz/tests/test_packagecopyjob.py'
24--- lib/lp/soyuz/tests/test_packagecopyjob.py 2014-04-24 06:45:51 +0000
25+++ lib/lp/soyuz/tests/test_packagecopyjob.py 2014-05-15 09:40:47 +0000
26@@ -1,4 +1,4 @@
27-# Copyright 2010-2013 Canonical Ltd. This software is licensed under the
28+# Copyright 2010-2014 Canonical Ltd. This software is licensed under the
29 # GNU Affero General Public License version 3 (see the file LICENSE).
30
31 """Tests for sync package jobs."""
32@@ -192,6 +192,13 @@
33 email = format_address_for_person(job.requester)
34 self.assertEqual([email], job.getErrorRecipients())
35
36+ def test_getErrorRecipients_sponsored(self):
37+ # If there is a sponsored person, they are notified of errors too.
38+ job = self.makeJob(sponsored=self.factory.makePerson())
39+ recipients = (job.requester, job.sponsored)
40+ emails = [format_address_for_person(person) for person in recipients]
41+ self.assertContentEqual(emails, job.getErrorRecipients())
42+
43 def test_create(self):
44 # A PackageCopyJob can be created and stores its arguments.
45 distroseries = self.factory.makeDistroSeries()