← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~abentley/launchpad/fix-blueprints-home-with-proprietary into lp:launchpad

 

Aaron Bentley has proposed merging lp:~abentley/launchpad/fix-blueprints-home-with-proprietary into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1050960 in Launchpad itself: "embargoed (or proprietary) specifications break the blueprints front page"
  https://bugs.launchpad.net/launchpad/+bug/1050960

For more details, see:
https://code.launchpad.net/~abentley/launchpad/fix-blueprints-home-with-proprietary/+merge/124485

= Summary =
Fix bug #1050960: embargoed (or proprietary) specifications break the blueprints front page

== Proposed fix ==
Show only PUBLIC specifications on the blueprints home page

== Pre-implementation notes ==
Discussed with deryck.

== LOC Rationale ==
Part of Private Projects

== Implementation details ==
This was the simplest-possible fix for this critical bug, that would otherwise block us from deploying Blueprints.

== Tests ==
bin/test -t test_index_with_pro spec

== Demo and Q/A ==
View the Blueprints home page.  You should not get a "Not allowed" page.  Create a Proprietary blueprint.  View the Blueprints home page.  You should not get a "Not allowed" page, but the blueprint you created will not be listed under "Recently registered".


= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/blueprints/model/specification.py
  lib/lp/blueprints/browser/tests/test_specification.py
-- 
https://code.launchpad.net/~abentley/launchpad/fix-blueprints-home-with-proprietary/+merge/124485
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/fix-blueprints-home-with-proprietary into lp:launchpad.
=== modified file 'lib/lp/blueprints/browser/tests/test_specification.py'
--- lib/lp/blueprints/browser/tests/test_specification.py	2012-09-13 14:16:11 +0000
+++ lib/lp/blueprints/browser/tests/test_specification.py	2012-09-14 17:35:33 +0000
@@ -183,6 +183,29 @@
     test_case.useFixture(fixture)
 
 
+class TestSpecificationSet(BrowserTestCase):
+
+    layer = DatabaseFunctionalLayer
+
+    def test_index_with_proprietary(self):
+        """Blueprints home page tolerates proprietary Specifications."""
+        specs = getUtility(ISpecificationSet)
+        spec = self.factory.makeSpecification()
+        spec_name = spec.name
+        spec_owner = spec.owner
+        browser = self.getViewBrowser(specs)
+        self.assertNotIn('Not allowed', browser.contents)
+        self.assertIn(spec_name, browser.contents)
+        with person_logged_in(spec_owner):
+            removeSecurityProxy(spec.target)._ensurePolicies(
+                [InformationType.PROPRIETARY])
+            spec.transitionToInformationType(InformationType.PROPRIETARY,
+                                             spec.owner)
+        browser = self.getViewBrowser(specs)
+        self.assertNotIn('Not allowed', browser.contents)
+        self.assertNotIn(spec_name, browser.contents)
+
+
 class TestSpecificationInformationType(BrowserTestCase):
 
     layer = DatabaseFunctionalLayer

=== modified file 'lib/lp/blueprints/model/specification.py'
--- lib/lp/blueprints/model/specification.py	2012-09-13 14:16:11 +0000
+++ lib/lp/blueprints/model/specification.py	2012-09-14 17:35:33 +0000
@@ -1086,10 +1086,11 @@
         #
 
         # filter out specs on inactive products
-        base = """(Specification.product IS NULL OR
+        base = """((Specification.product IS NULL OR
                    Specification.product NOT IN
                     (SELECT Product.id FROM Product
                      WHERE Product.active IS FALSE))
+                   AND Specification.information_type = 1)
                 """
         query = base
         # look for informational specs


Follow ups