launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #11822
[Merge] lp:~stevenk/launchpad/illegaltarget-if-pillar-is-new into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/illegaltarget-if-pillar-is-new into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1049020 in Launchpad itself: "Targeting a bug to a series OOPSes if the information type is no longer legal"
https://bugs.launchpad.net/launchpad/+bug/1049020
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/illegaltarget-if-pillar-is-new/+merge/123862
Only validate if the information_type of a bug is legal if it's targeting a new pillar. This allows users to nominate bugs against series if the bug is already bending the rules.
--
https://code.launchpad.net/~stevenk/launchpad/illegaltarget-if-pillar-is-new/+merge/123862
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/illegaltarget-if-pillar-is-new into lp:launchpad.
=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py 2012-08-30 12:22:35 +0000
+++ lib/lp/bugs/model/bugtask.py 2012-09-11 23:50:23 +0000
@@ -338,7 +338,8 @@
raise IllegalTarget(e[0])
legal_types = target.pillar.getAllowedBugInformationTypes()
- if bug.information_type not in legal_types:
+ new_pillar = target.pillar not in bug.affected_pillars
+ if new_pillar and bug.information_type not in legal_types:
raise IllegalTarget(
"%s doesn't allow %s bugs." % (
target.pillar.bugtargetdisplayname, bug.information_type.title))
=== modified file 'lib/lp/bugs/model/tests/test_bugtask.py'
--- lib/lp/bugs/model/tests/test_bugtask.py 2012-08-30 12:22:35 +0000
+++ lib/lp/bugs/model/tests/test_bugtask.py 2012-09-11 23:50:23 +0000
@@ -3055,6 +3055,19 @@
"%s doesn't allow Public bugs." % commercial_prod.displayname,
validate_target, bug, commercial_prod)
+ def test_illegal_information_type_allowed_if_pillar_not_new(self):
+ # The bug's current information_type does not have to be permitted if
+ # we already affect the pillar.
+ public_prod = self.factory.makeProduct()
+ commercial_prod = self.factory.makeProduct(
+ bug_sharing_policy=BugSharingPolicy.PROPRIETARY_OR_PUBLIC)
+ commercial_series = self.factory.makeProductSeries(
+ product=commercial_prod)
+ bug = self.factory.makeBug(target=public_prod)
+ self.factory.makeBugTask(bug=bug, target=commercial_prod)
+ removeSecurityProxy(bug).information_type = InformationType.USERDATA
+ validate_target(removeSecurityProxy(bug), commercial_series)
+
class TestValidateNewTarget(TestCaseWithFactory, ValidateTargetMixin):
Follow ups