Merge lp:~stevenk/launchpad/no-proprietary-multi-pillar-bug-vocab into lp:launchpad

Proposed by Steve Kowalik on 2012-07-03
Status: Merged
Approved by: Steve Kowalik on 2012-07-03
Approved revision: no longer in the source branch.
Merged at revision: 15544
Proposed branch: lp:~stevenk/launchpad/no-proprietary-multi-pillar-bug-vocab
Merge into: lp:launchpad
Diff against target: 55 lines (+21/-2)
2 files modified
lib/lp/registry/tests/test_information_type_vocabulary.py (+18/-1)
lib/lp/registry/vocabularies.py (+3/-1)
To merge this branch: bzr merge lp:~stevenk/launchpad/no-proprietary-multi-pillar-bug-vocab
Reviewer Review Type Date Requested Status
Ian Booth (community) 2012-07-03 Approve on 2012-07-03
Review via email: mp+113149@code.launchpad.net

Commit Message

Do not add PROPRIETARY to the information_type vocabulary if the context if a multi-pillar bug, since those are verboten.

Description of the Change

Do not add PROPRIETARY to the information_type vocabulary if the context if a multi-pillar bug, since those are verboten.

Also drive-by a change where the comment did not match what the test did.

To post a comment you must log in.
Ian Booth (wallyworld) wrote :

Great.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/tests/test_information_type_vocabulary.py'
2--- lib/lp/registry/tests/test_information_type_vocabulary.py 2012-05-31 09:08:20 +0000
3+++ lib/lp/registry/tests/test_information_type_vocabulary.py 2012-07-03 06:09:21 +0000
4@@ -30,7 +30,8 @@
5
6 def test_vocabulary_items_project(self):
7 # The vocab has all info types for a project without private_bugs set.
8- vocab = InformationTypeVocabulary()
9+ product = self.factory.makeProduct()
10+ vocab = InformationTypeVocabulary(product)
11 for info_type in InformationType:
12 self.assertIn(info_type.value, vocab)
13
14@@ -86,3 +87,19 @@
15 "Visible only to users with whom the project has shared "
16 "information containing user data.",
17 term.description)
18+
19+ def test_multi_pillar_bugs(self):
20+ # Multi-pillar bugs are forbidden from being PROPRIETARY, no matter
21+ # the setting of proprietary_information_type.disabled.
22+ bug = self.factory.makeBug()
23+ self.factory.makeBugTask(bug=bug, target=self.factory.makeProduct())
24+ vocab = InformationTypeVocabulary(bug)
25+ self.assertRaises(LookupError, vocab.getTermByToken, 'PROPRIETARY')
26+
27+ def test_multi_task_bugs(self):
28+ # Multi-task bugs are allowed to be PROPRIETARY.
29+ bug = self.factory.makeBug()
30+ self.factory.makeBugTask(bug=bug) # Uses the same pillar.
31+ vocab = InformationTypeVocabulary(bug)
32+ term = vocab.getTermByToken('PROPRIETARY')
33+ self.assertEqual('Proprietary', term.title)
34
35=== modified file 'lib/lp/registry/vocabularies.py'
36--- lib/lp/registry/vocabularies.py 2012-06-07 21:53:47 +0000
37+++ lib/lp/registry/vocabularies.py 2012-07-03 06:09:21 +0000
38@@ -103,6 +103,7 @@
39
40 from lp.app.interfaces.launchpad import ILaunchpadCelebrities
41 from lp.blueprints.interfaces.specification import ISpecification
42+from lp.bugs.interfaces.bug import IBug
43 from lp.bugs.interfaces.bugtask import IBugTask
44 from lp.registry.enums import InformationType
45 from lp.registry.interfaces.accesspolicy import IAccessPolicySource
46@@ -2250,7 +2251,8 @@
47 'disclosure.proprietary_information_type.disabled'))
48 show_userdata_as_private = bool(getFeatureFlag(
49 'disclosure.display_userdata_as_private.enabled'))
50- if not proprietary_disabled:
51+ if not proprietary_disabled and not (IBug.providedBy(context) and
52+ len(context.affected_pillars) > 1):
53 types.append(InformationType.PROPRIETARY)
54 if (context is None or
55 not IProduct.providedBy(context) or