Merge lp:~stevenk/launchpad/bugalsoaffects-packaging-no-series into lp:launchpad

Proposed by Steve Kowalik on 2012-01-03
Status: Merged
Approved by: William Grant on 2012-01-03
Approved revision: no longer in the source branch.
Merged at revision: 14619
Proposed branch: lp:~stevenk/launchpad/bugalsoaffects-packaging-no-series
Merge into: lp:launchpad
Diff against target: 68 lines (+28/-8)
2 files modified
lib/lp/bugs/browser/bugalsoaffects.py (+7/-6)
lib/lp/bugs/browser/tests/test_bugtask_adding.py (+21/-2)
To merge this branch: bzr merge lp:~stevenk/launchpad/bugalsoaffects-packaging-no-series
Reviewer Review Type Date Requested Status
William Grant code 2012-01-03 Approve on 2012-01-03
Review via email: mp+87309@code.launchpad.net

Commit Message

[r=wgrant][bug=810727] Do not create packaging links in BugAlsoAffectsView if the distribution we get from the DSP task on the bugtask has no currentseries.

Description of the Change

Do not create packaging links in BugAlsoAffectsView if the distribution we get from the DSP task on the bugtask has no currentseries.

To post a comment you must log in.
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/bugs/browser/bugalsoaffects.py'
2--- lib/lp/bugs/browser/bugalsoaffects.py 2012-01-01 02:58:52 +0000
3+++ lib/lp/bugs/browser/bugalsoaffects.py 2012-01-03 00:34:27 +0000
4@@ -663,12 +663,13 @@
5 if data.get('add_packaging', False):
6 # Create a packaging link so that Launchpad will suggest the
7 # upstream project to the user.
8- packaging_util = getUtility(IPackagingUtil)
9- packaging_util.createPackaging(
10- productseries=data['product'].development_focus,
11- sourcepackagename=self.context.target.sourcepackagename,
12- distroseries=self.context.target.distribution.currentseries,
13- packaging=PackagingType.PRIME, owner=self.user)
14+ series = self.context.target.distribution.currentseries
15+ if series:
16+ getUtility(IPackagingUtil).createPackaging(
17+ productseries=data['product'].development_focus,
18+ sourcepackagename=self.context.target.sourcepackagename,
19+ distroseries=series, packaging=PackagingType.PRIME,
20+ owner=self.user)
21 return super(ProductBugTaskCreationStep, self).main_action(data)
22
23 @property
24
25=== modified file 'lib/lp/bugs/browser/tests/test_bugtask_adding.py'
26--- lib/lp/bugs/browser/tests/test_bugtask_adding.py 2012-01-01 02:58:52 +0000
27+++ lib/lp/bugs/browser/tests/test_bugtask_adding.py 2012-01-03 00:34:27 +0000
28@@ -31,7 +31,7 @@
29 self.sourcepackage = self.factory.makeSourcePackage(
30 sourcepackagename=self.sourcepackagename,
31 distroseries=self.ubuntu_series)
32- self.distrosourcepackage = self.factory.makeDistributionSourcePackage(
33+ self.dsp = self.factory.makeDistributionSourcePackage(
34 sourcepackagename=self.sourcepackagename, distribution=ubuntu)
35 self.factory.makeSourcePackagePublishingHistory(
36 sourcepackagename=self.sourcepackagename,
37@@ -41,7 +41,7 @@
38 self.user = self.factory.makePerson()
39 login_person(self.user)
40 self.bug_task = self.factory.makeBugTask(
41- target=self.distrosourcepackage, owner=self.user)
42+ target=self.dsp, owner=self.user)
43 self.bug = self.bug_task.bug
44
45 def test_choose_product_when_packaging_does_not_exist(self):
46@@ -160,3 +160,22 @@
47 self.sourcepackagename, self.ubuntu_series,
48 product.development_focus)
49 self.assertTrue(has_packaging)
50+
51+ def test_register_project_create_upstream_bugtask_no_series(self):
52+ # Adding a task that affects a product where the distribution has
53+ # no series does not error.
54+ dsp = self.factory.makeDistributionSourcePackage(
55+ sourcepackagename=self.sourcepackagename)
56+ self.bug_task = self.factory.makeBugTask(
57+ target=dsp, owner=self.user)
58+ form = {
59+ 'field.bug_url': 'http://bugs.foo.org/bugs/show_bug.cgi?id=8',
60+ 'field.name': 'fruit',
61+ 'field.displayname': 'Fruit',
62+ 'field.summary': 'The Fruit summary',
63+ 'field.add_packaging': 'on',
64+ 'field.actions.continue': 'Continue',
65+ }
66+ view = create_initialized_view(
67+ self.bug_task, '+affects-new-product', form=form)
68+ self.assertEqual([], view.errors)