← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/no-proprietary-multi-pillar-bug-vocab into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/no-proprietary-multi-pillar-bug-vocab/+merge/113149

Do not add PROPRIETARY to the information_type vocabulary if the context if a multi-pillar bug, since those are verboten.
-- 
https://code.launchpad.net/~stevenk/launchpad/no-proprietary-multi-pillar-bug-vocab/+merge/113149
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/no-proprietary-multi-pillar-bug-vocab into lp:launchpad.
=== modified file 'lib/lp/registry/tests/test_information_type_vocabulary.py'
--- lib/lp/registry/tests/test_information_type_vocabulary.py	2012-05-31 09:08:20 +0000
+++ lib/lp/registry/tests/test_information_type_vocabulary.py	2012-07-03 05:04:56 +0000
@@ -30,7 +30,8 @@
 
     def test_vocabulary_items_project(self):
         # The vocab has all info types for a project without private_bugs set.
-        vocab = InformationTypeVocabulary()
+        product = self.factory.makeProduct()
+        vocab = InformationTypeVocabulary(product)
         for info_type in InformationType:
             self.assertIn(info_type.value, vocab)
 
@@ -86,3 +87,11 @@
             "Visible only to users with whom the project has shared "
             "information containing user data.",
             term.description)
+
+    def test_multi_pillar_bugs(self):
+        # Multi-pillar bugs are forbidden from being PROPRIETARY, no matter
+        # the setting of proprietary_information_type.disabled.
+        bug = self.factory.makeBug()
+        self.factory.makeBugTask(bug=bug)
+        vocab = InformationTypeVocabulary(bug)
+        self.assertRaises(LookupError, vocab.getTermByToken, 'PROPRIETARY')

=== modified file 'lib/lp/registry/vocabularies.py'
--- lib/lp/registry/vocabularies.py	2012-06-07 21:53:47 +0000
+++ lib/lp/registry/vocabularies.py	2012-07-03 05:04:56 +0000
@@ -103,6 +103,7 @@
 
 from lp.app.interfaces.launchpad import ILaunchpadCelebrities
 from lp.blueprints.interfaces.specification import ISpecification
+from lp.bugs.interfaces.bug import IBug
 from lp.bugs.interfaces.bugtask import IBugTask
 from lp.registry.enums import InformationType
 from lp.registry.interfaces.accesspolicy import IAccessPolicySource
@@ -2250,7 +2251,11 @@
             'disclosure.proprietary_information_type.disabled'))
         show_userdata_as_private = bool(getFeatureFlag(
             'disclosure.display_userdata_as_private.enabled'))
-        if not proprietary_disabled:
+        proprietary_allowed = True
+        if (context and IBug.providedBy(context) and
+            len(context.bugtasks) > 1):
+            proprietary_allowed = False
+        if not proprietary_disabled and proprietary_allowed:
             types.append(InformationType.PROPRIETARY)
         if (context is None or
             not IProduct.providedBy(context) or


Follow ups