launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #12146
[Merge] lp:~jcsackett/launchpad/unbreak-bug-renomination into lp:launchpad
j.c.sackett has proposed merging lp:~jcsackett/launchpad/unbreak-bug-renomination into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jcsackett/launchpad/unbreak-bug-renomination/+merge/124971
Summary
=======
Right now you can't renominate a bug for a series if the related task for a
previous nomination has been deleted.
This is because the code to find the nomination is passed the sourcepackage,
but getNominationFor only knows what to do with series (product/distro).
The fix is pretty simple; if the passed in target is a sourcepackage, simply
get the distroseries from it and use that to get the nomination.
Preimp
======
Spoke with Curtis Hovey.
Implementation
==============
A new clause is added in the if statement in getNominationFor; it checks if
it's received a sourcepackage, and uses the distroseries for the filter_args.
Tests
=====
bin/test -vvct test_getNominationFor_sourcepackage
QA
==
Add a nomination to a bug. Delete the bugtask created. See if you can
renominate for the series.
LoC
===
This is a fix for a disclosure regression; the disclosure project is already
sourced.
Lint
====
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/bugs/model/tests/test_bug.py
lib/lp/bugs/model/bug.py
--
https://code.launchpad.net/~jcsackett/launchpad/unbreak-bug-renomination/+merge/124971
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jcsackett/launchpad/unbreak-bug-renomination into lp:launchpad.
=== modified file 'lib/lp/bugs/model/bug.py'
--- lib/lp/bugs/model/bug.py 2012-09-07 20:25:51 +0000
+++ lib/lp/bugs/model/bug.py 2012-09-18 16:16:19 +0000
@@ -1587,10 +1587,13 @@
def getNominationFor(self, target):
"""See `IBug`."""
+
if IDistroSeries.providedBy(target):
filter_args = dict(distroseriesID=target.id)
elif IProductSeries.providedBy(target):
filter_args = dict(productseriesID=target.id)
+ elif ISourcePackage.providedBy(target):
+ filter_args = dict(distroseriesID=target.series.id)
else:
return None
=== modified file 'lib/lp/bugs/model/tests/test_bug.py'
--- lib/lp/bugs/model/tests/test_bug.py 2012-08-30 00:13:11 +0000
+++ lib/lp/bugs/model/tests/test_bug.py 2012-09-18 16:16:19 +0000
@@ -61,6 +61,15 @@
layer = DatabaseFunctionalLayer
+ def test_getNominationFor_sourcepackage(self):
+ sourcepackage = self.factory.makeSourcePackage()
+ series = sourcepackage.distroseries
+ bug = self.factory.makeBug(target=series.distribution)
+ with person_logged_in(series.owner):
+ bug.addNomination(series.owner, series)
+ nomination = bug.getNominationFor(sourcepackage)
+ self.assertEqual(series, nomination.target)
+
def test_markAsDuplicate_None(self):
# Calling markAsDuplicate(None) on a bug that is not currently a
# duplicate works correctly, and does not raise an AttributeError.
Follow ups