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

Proposed by Aaron Bentley on 2012-09-14
Status: Merged
Approved by: Aaron Bentley on 2012-09-14
Approved revision: no longer in the source branch.
Merged at revision: 15961
Proposed branch: lp:~abentley/launchpad/fix-blueprints-home-with-proprietary
Merge into: lp:launchpad
Diff against target: 50 lines (+25/-1)
2 files modified
lib/lp/blueprints/browser/tests/test_specification.py (+23/-0)
lib/lp/blueprints/model/specification.py (+2/-1)
To merge this branch: bzr merge lp:~abentley/launchpad/fix-blueprints-home-with-proprietary
Reviewer Review Type Date Requested Status
Deryck Hodge (community) 2012-09-14 Approve on 2012-09-14
Review via email: mp+124485@code.launchpad.net

Commit Message

Blueprints home page tolerates proprietary Specifications.

Description of the Change

= 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

To post a comment you must log in.
Deryck Hodge (deryck) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/blueprints/browser/tests/test_specification.py'
2--- lib/lp/blueprints/browser/tests/test_specification.py 2012-09-13 14:16:11 +0000
3+++ lib/lp/blueprints/browser/tests/test_specification.py 2012-09-14 17:35:33 +0000
4@@ -183,6 +183,29 @@
5 test_case.useFixture(fixture)
6
7
8+class TestSpecificationSet(BrowserTestCase):
9+
10+ layer = DatabaseFunctionalLayer
11+
12+ def test_index_with_proprietary(self):
13+ """Blueprints home page tolerates proprietary Specifications."""
14+ specs = getUtility(ISpecificationSet)
15+ spec = self.factory.makeSpecification()
16+ spec_name = spec.name
17+ spec_owner = spec.owner
18+ browser = self.getViewBrowser(specs)
19+ self.assertNotIn('Not allowed', browser.contents)
20+ self.assertIn(spec_name, browser.contents)
21+ with person_logged_in(spec_owner):
22+ removeSecurityProxy(spec.target)._ensurePolicies(
23+ [InformationType.PROPRIETARY])
24+ spec.transitionToInformationType(InformationType.PROPRIETARY,
25+ spec.owner)
26+ browser = self.getViewBrowser(specs)
27+ self.assertNotIn('Not allowed', browser.contents)
28+ self.assertNotIn(spec_name, browser.contents)
29+
30+
31 class TestSpecificationInformationType(BrowserTestCase):
32
33 layer = DatabaseFunctionalLayer
34
35=== modified file 'lib/lp/blueprints/model/specification.py'
36--- lib/lp/blueprints/model/specification.py 2012-09-13 14:16:11 +0000
37+++ lib/lp/blueprints/model/specification.py 2012-09-14 17:35:33 +0000
38@@ -1086,10 +1086,11 @@
39 #
40
41 # filter out specs on inactive products
42- base = """(Specification.product IS NULL OR
43+ base = """((Specification.product IS NULL OR
44 Specification.product NOT IN
45 (SELECT Product.id FROM Product
46 WHERE Product.active IS FALSE))
47+ AND Specification.information_type = 1)
48 """
49 query = base
50 # look for informational specs