launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05977
[Merge] lp:~wallyworld/launchpad/renominate-rejected-nomination-253068 into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/renominate-rejected-nomination-253068 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #253068 in Bazaar: "cannot use launchpad-login command without internet connection"
https://bugs.launchpad.net/bzr/+bug/253068
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/renominate-rejected-nomination-253068/+merge/86212
== Implementation ==
1. Change Bug.canBeNominatedFor() to return True even if there's an existing BugNomination, so long as the stats is DECLINED.
2. Change Bug.addNomination() so that if there's an existing BugNomination, the status is set to PROPOSED and decider and date_decided set to None, otherwise just create a new one as before.
NB: the addNomination() does not alter the original date_created if there's an existing nomination
Also, the bug report suggested recording a comment saying why the bug was being renominated. This is not done here. It will require a schema change, a data model change, and changes to existing processes like email generation and notifications. If required, this work can be done in subsequent branches.
== Tests ==
Add to existing doc test: bug-nomination.txt
== Lint ==
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/bugs/doc/bug-nomination.txt
lib/lp/bugs/model/bug.py
./lib/lp/bugs/doc/bug-nomination.txt
1: narrative uses a moin header.
155: narrative uses a moin header.
217: narrative uses a moin header.
350: narrative uses a moin header.
399: narrative uses a moin header.
439: narrative uses a moin header.
508: narrative uses a moin header.
526: narrative uses a moin header.
--
https://code.launchpad.net/~wallyworld/launchpad/renominate-rejected-nomination-253068/+merge/86212
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/renominate-rejected-nomination-253068 into lp:launchpad.
=== modified file 'lib/lp/bugs/doc/bug-nomination.txt'
--- lib/lp/bugs/doc/bug-nomination.txt 2011-12-08 20:24:09 +0000
+++ lib/lp/bugs/doc/bug-nomination.txt 2011-12-19 10:42:27 +0000
@@ -377,6 +377,24 @@
>>> ubuntu_breezy_autotest_nomination.date_decided
datetime...
+If a nomination is declined, the bug can be re-nominated for the same target.
+The decider and date declined are reset to None.
+
+ >>> bug_one.canBeNominatedFor(ubuntu_breezy_autotest)
+ True
+ >>> breezy_nomination = bug_one.addNomination(
+ ... target=ubuntu_breezy_autotest, owner=no_privs)
+ >>> ubuntu_breezy_autotest_nomination.isApproved()
+ False
+ >>> breezy_nomination.isDeclined()
+ False
+ >>> breezy_nomination.isProposed()
+ True
+ >>> print breezy_nomination.decider
+ None
+ >>> print breezy_nomination.date_decided
+ None
+
== Automatic targeting of new source packages ==
=== modified file 'lib/lp/bugs/model/bug.py'
--- lib/lp/bugs/model/bug.py 2011-12-08 22:32:41 +0000
+++ lib/lp/bugs/model/bug.py 2011-12-19 10:42:27 +0000
@@ -150,6 +150,7 @@
)
from lp.bugs.interfaces.bugmessage import IBugMessageSet
from lp.bugs.interfaces.bugnomination import (
+ BugNominationStatus,
NominationError,
NominationSeriesObsoleteError,
)
@@ -1550,16 +1551,28 @@
raise NominationError(
"Only bug supervisors or owners can nominate bugs.")
- nomination = BugNomination(
- owner=owner, bug=self, distroseries=distroseries,
- productseries=productseries)
+ # There may be an existing DECLINED nomination. If so, we set the
+ # status back to PROPOSED. We do not alter the original date_created.
+ nomination = None
+ try:
+ nomination = self.getNominationFor(target)
+ except NotFoundError:
+ pass
+ if nomination:
+ nomination.status = BugNominationStatus.PROPOSED
+ nomination.decider = None
+ nomination.date_decided = None
+ else:
+ nomination = BugNomination(
+ owner=owner, bug=self, distroseries=distroseries,
+ productseries=productseries)
self.addChange(SeriesNominated(UTC_NOW, owner, target))
return nomination
def canBeNominatedFor(self, target):
"""See `IBug`."""
try:
- self.getNominationFor(target)
+ nomination = self.getNominationFor(target)
except NotFoundError:
# No nomination exists. Let's see if the bug is already
# directly targeted to this nomination target.
@@ -1590,7 +1603,9 @@
return False
else:
# The bug is already nominated for this nomination target.
- return False
+ # If the status is declined, the bug can be renominated, else
+ # return False
+ return nomination.status == BugNominationStatus.DECLINED
def getNominationFor(self, target):
"""See `IBug`."""