launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #11534
[Merge] lp:~wallyworld/launchpad/rollback-15893 into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/rollback-15893 into lp:launchpad.
Requested reviews:
Ian Booth (wallyworld)
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/rollback-15893/+merge/122428
Rollback rev 15893
--
https://code.launchpad.net/~wallyworld/launchpad/rollback-15893/+merge/122428
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/registry/interfaces/distribution.py'
--- lib/lp/registry/interfaces/distribution.py 2012-08-30 06:11:00 +0000
+++ lib/lp/registry/interfaces/distribution.py 2012-09-02 23:04:18 +0000
@@ -628,12 +628,6 @@
:return: The `InformationType`.
"""
- def getAllowedBranchInformationTypes():
- """Get the information types that a branch in this distro can have.
-
- :return: A sequence of `InformationType`s.
- """
-
def userCanEdit(user):
"""Can the user edit this distribution?"""
=== modified file 'lib/lp/registry/interfaces/product.py'
--- lib/lp/registry/interfaces/product.py 2012-08-30 06:11:00 +0000
+++ lib/lp/registry/interfaces/product.py 2012-09-02 23:04:18 +0000
@@ -797,12 +797,6 @@
:return: The `InformationType`.
"""
- def getAllowedBranchInformationTypes():
- """Get the information types that a branch in this project can have.
-
- :return: A sequence of `InformationType`s.
- """
-
def getVersionSortedSeries(statuses=None, filter_statuses=None):
"""Return all the series sorted by the name field as a version.
=== modified file 'lib/lp/registry/interfaces/sharingservice.py'
--- lib/lp/registry/interfaces/sharingservice.py 2012-08-30 06:11:00 +0000
+++ lib/lp/registry/interfaces/sharingservice.py 2012-09-02 23:04:18 +0000
@@ -112,13 +112,7 @@
"""
def getInformationTypes(pillar):
- """Return the allowed information types for the given pillar.
-
- The allowed information types are those for which bugs and branches
- may be created. This does not mean that there will necessarily be bugs
- and branches of these types; the result is used to populate the allowed
- choices in the grantee sharing pillar and other similar things.
- """
+ """Return the allowed information types for the given pillar."""
def getBugSharingPolicies(pillar):
"""Return the allowed bug sharing policies for the given pillar."""
=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py 2012-08-30 06:11:00 +0000
+++ lib/lp/registry/model/distribution.py 2012-09-02 23:04:18 +0000
@@ -91,7 +91,6 @@
IFindOfficialBranchLinks,
)
from lp.registry.enums import (
- FREE_INFORMATION_TYPES,
InformationType,
PRIVATE_INFORMATION_TYPES,
PUBLIC_INFORMATION_TYPES,
@@ -1575,16 +1574,15 @@
def getAllowedBugInformationTypes(self):
"""See `IDistribution.`"""
- return FREE_INFORMATION_TYPES
+ types = set(InformationType.items)
+ types.discard(InformationType.PROPRIETARY)
+ types.discard(InformationType.EMBARGOED)
+ return types
def getDefaultBugInformationType(self):
"""See `IDistribution.`"""
return InformationType.PUBLIC
- def getAllowedBranchInformationTypes(self):
- """See `IDistribution.`"""
- return FREE_INFORMATION_TYPES
-
def userCanEdit(self, user):
"""See `IDistribution`."""
if user is None:
=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py 2012-08-31 07:09:50 +0000
+++ lib/lp/registry/model/product.py 2012-09-02 23:04:18 +0000
@@ -119,7 +119,6 @@
from lp.registry.enums import (
BranchSharingPolicy,
BugSharingPolicy,
- FREE_INFORMATION_TYPES,
InformationType,
PRIVATE_INFORMATION_TYPES,
)
@@ -590,7 +589,11 @@
"""See `IProduct.`"""
if self.bug_sharing_policy is not None:
return BUG_POLICY_ALLOWED_TYPES[self.bug_sharing_policy]
- return FREE_INFORMATION_TYPES
+
+ types = set(InformationType.items)
+ types.discard(InformationType.PROPRIETARY)
+ types.discard(InformationType.EMBARGOED)
+ return types
def getDefaultBugInformationType(self):
"""See `IDistribution.`"""
@@ -601,12 +604,6 @@
else:
return InformationType.PUBLIC
- def getAllowedBranchInformationTypes(self):
- """See `IProduct.`"""
- if self.branch_sharing_policy is not None:
- return BRANCH_POLICY_ALLOWED_TYPES[self.branch_sharing_policy]
- return FREE_INFORMATION_TYPES
-
def _ensurePolicies(self, information_types):
# Ensure that the product has access policies for the specified
# information types.
=== modified file 'lib/lp/registry/services/sharingservice.py'
--- lib/lp/registry/services/sharingservice.py 2012-08-30 07:17:39 +0000
+++ lib/lp/registry/services/sharingservice.py 2012-09-02 23:04:18 +0000
@@ -32,7 +32,7 @@
from lp.registry.enums import (
BranchSharingPolicy,
BugSharingPolicy,
- PRIVATE_INFORMATION_TYPES,
+ InformationType,
SharingPermission,
)
from lp.registry.interfaces.accesspolicy import (
@@ -255,11 +255,16 @@
def getInformationTypes(self, pillar):
"""See `ISharingService`."""
- allowed_types = set(pillar.getAllowedBugInformationTypes()).union(
- pillar.getAllowedBranchInformationTypes())
- allowed_private_types = allowed_types.intersection(
- PRIVATE_INFORMATION_TYPES)
- return self._makeEnumData(allowed_private_types)
+ allowed_types = [
+ InformationType.PRIVATESECURITY,
+ InformationType.USERDATA]
+ # Products with current commercial subscriptions are also allowed to
+ # have a PROPRIETARY information type.
+ if (IProduct.providedBy(pillar) and
+ pillar.has_current_commercial_subscription):
+ allowed_types.append(InformationType.PROPRIETARY)
+
+ return self._makeEnumData(allowed_types)
def getBranchSharingPolicies(self, pillar):
"""See `ISharingService`."""
=== modified file 'lib/lp/registry/services/tests/test_sharingservice.py'
--- lib/lp/registry/services/tests/test_sharingservice.py 2012-08-30 07:17:39 +0000
+++ lib/lp/registry/services/tests/test_sharingservice.py 2012-09-02 23:04:18 +0000
@@ -139,20 +139,13 @@
[InformationType.PRIVATESECURITY, InformationType.USERDATA])
def test_getInformationTypes_commercial_product(self):
- product = self.factory.makeProduct(
- branch_sharing_policy=BranchSharingPolicy.PROPRIETARY,
- bug_sharing_policy=BugSharingPolicy.PROPRIETARY)
- self._assert_getInformationTypes(
- product,
- [InformationType.PROPRIETARY])
-
- def test_getInformationTypes_product_with_embargoed(self):
- product = self.factory.makeProduct(
- branch_sharing_policy=BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY,
- bug_sharing_policy=BugSharingPolicy.PROPRIETARY)
- self._assert_getInformationTypes(
- product,
- [InformationType.PROPRIETARY, InformationType.EMBARGOED])
+ product = self.factory.makeProduct()
+ self.factory.makeCommercialSubscription(product)
+ self._assert_getInformationTypes(
+ product,
+ [InformationType.PRIVATESECURITY,
+ InformationType.USERDATA,
+ InformationType.PROPRIETARY])
def test_getInformationTypes_distro(self):
distro = self.factory.makeDistribution()
=== modified file 'lib/lp/registry/tests/test_distribution.py'
--- lib/lp/registry/tests/test_distribution.py 2012-08-30 07:17:39 +0000
+++ lib/lp/registry/tests/test_distribution.py 2012-09-02 23:04:18 +0000
@@ -276,14 +276,6 @@
InformationType.PUBLIC,
self.factory.makeDistribution().getDefaultBugInformationType())
- def test_getAllowedBranchInformationTypes(self):
- # All distros currently support just the non-proprietary
- # information types.
- self.assertContentEqual(
- [InformationType.PUBLIC, InformationType.PUBLICSECURITY,
- InformationType.PRIVATESECURITY, InformationType.USERDATA],
- self.factory.makeDistribution().getAllowedBranchInformationTypes())
-
class TestDistributionCurrentSourceReleases(
CurrentSourceReleasesMixin, TestCase):
=== modified file 'lib/lp/registry/tests/test_product.py'
--- lib/lp/registry/tests/test_product.py 2012-08-30 07:17:39 +0000
+++ lib/lp/registry/tests/test_product.py 2012-09-02 23:04:18 +0000
@@ -459,50 +459,6 @@
product.getDefaultBugInformationType())
-class TestProductBranchInformationTypes(TestCaseWithFactory):
-
- layer = DatabaseFunctionalLayer
-
- def test_no_policy(self):
- # New projects can only use the non-proprietary information
- # types.
- product = self.factory.makeProduct()
- self.assertContentEqual(
- FREE_INFORMATION_TYPES, product.getAllowedBranchInformationTypes())
-
- def test_sharing_policy_public_or_proprietary(self):
- # branch_sharing_policy can enable Proprietary.
- product = self.factory.makeProduct(
- branch_sharing_policy=BranchSharingPolicy.PUBLIC_OR_PROPRIETARY)
- self.assertContentEqual(
- FREE_INFORMATION_TYPES + (InformationType.PROPRIETARY,),
- product.getAllowedBranchInformationTypes())
-
- def test_sharing_policy_proprietary_or_public(self):
- # branch_sharing_policy can enable Proprietary.
- product = self.factory.makeProduct(
- branch_sharing_policy=BranchSharingPolicy.PROPRIETARY_OR_PUBLIC)
- self.assertContentEqual(
- FREE_INFORMATION_TYPES + (InformationType.PROPRIETARY,),
- product.getAllowedBranchInformationTypes())
-
- def test_sharing_policy_proprietary(self):
- # branch_sharing_policy can enable only Proprietary.
- product = self.factory.makeProduct(
- branch_sharing_policy=BranchSharingPolicy.PROPRIETARY)
- self.assertContentEqual(
- [InformationType.PROPRIETARY],
- product.getAllowedBranchInformationTypes())
-
- def test_sharing_policy_embargoed_or_proprietary(self):
- # branch_sharing_policy can enable Embargoed or Proprietary.
- product = self.factory.makeProduct(
- branch_sharing_policy=BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY)
- self.assertContentEqual(
- [InformationType.PROPRIETARY, InformationType.EMBARGOED],
- product.getAllowedBranchInformationTypes())
-
-
class ProductPermissionTestCase(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
Follow ups