← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/move-to-informationtype into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/move-to-informationtype into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #948083 in Launchpad itself: "Sharing terminology is used inconsistently"
  https://bugs.launchpad.net/launchpad/+bug/948083

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/move-to-informationtype/+merge/96271

Mechanically switch from AccessPolicyType to InformationType using the power of sed and sponge.

I also ran format-imports and update-copyright over changed files and corrected some obvious docstring errors.

I also drove-by a fix for PUBLICSECURITY -> UNEMBARGOEDSECURITY.
-- 
https://code.launchpad.net/~stevenk/launchpad/move-to-informationtype/+merge/96271
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/move-to-informationtype into lp:launchpad.
=== modified file 'lib/canonical/launchpad/icing/css/colours.css'
--- lib/canonical/launchpad/icing/css/colours.css	2012-02-22 05:22:13 +0000
+++ lib/canonical/launchpad/icing/css/colours.css	2012-03-07 00:30:25 +0000
@@ -351,7 +351,7 @@
     color: green;
     }
 
-.accessPolicyPUBLICSECURITY, .accessPolicyPUBLICSECURITY a {
+.accessPolicyUNEMBARGOEDSECURITY, .accessPolicyUNEMBARGOEDSECURITY a {
     color: #1f7dff;
     }
 

=== modified file 'lib/lp/bugs/tests/test_bug_mirror_access_triggers.py'
--- lib/lp/bugs/tests/test_bug_mirror_access_triggers.py	2012-02-27 06:04:25 +0000
+++ lib/lp/bugs/tests/test_bug_mirror_access_triggers.py	2012-03-07 00:30:25 +0000
@@ -11,12 +11,12 @@
 from zope.component import getUtility
 from zope.security.proxy import removeSecurityProxy
 
-from lp.registry.enums import AccessPolicyType
+from lp.registry.enums import InformationType
 from lp.registry.interfaces.accesspolicy import (
     IAccessArtifactGrantSource,
     IAccessArtifactSource,
+    IAccessPolicyArtifactSource,
     IAccessPolicySource,
-    IAccessPolicyArtifactSource,
     )
 from lp.services.features.testing import FeatureFixture
 from lp.testing import TestCaseWithFactory
@@ -57,9 +57,9 @@
         grant_count = len(grants)
 
         if removeSecurityProxy(bug).security_related:
-            policy_type = AccessPolicyType.EMBARGOEDSECURITY
+            policy_type = InformationType.EMBARGOEDSECURITY
         else:
-            policy_type = AccessPolicyType.USERDATA
+            policy_type = InformationType.USERDATA
 
         # Get the relevant access policies, confirming that there's one
         # for every pillar.
@@ -81,7 +81,7 @@
     def makeBugAndPolicies(self, private=False, policy_types=None):
         if policy_types is None:
             policy_types = [
-                AccessPolicyType.USERDATA, AccessPolicyType.EMBARGOEDSECURITY]
+                InformationType.USERDATA, InformationType.EMBARGOEDSECURITY]
         product = self.factory.makeProduct()
         for policy_type in policy_types:
             self.factory.makeAccessPolicy(pillar=product, type=policy_type)
@@ -125,7 +125,7 @@
         # Adding a task on a new product links its policy.
         product = self.factory.makeProduct()
         self.factory.makeAccessPolicy(
-            pillar=product, type=AccessPolicyType.USERDATA)
+            pillar=product, type=InformationType.USERDATA)
 
         bug = self.makeBugAndPolicies(private=True)
         bug.addTask(bug.owner, product)
@@ -135,7 +135,7 @@
         # Removing a task removes its policy.
         product = self.factory.makeProduct()
         self.factory.makeAccessPolicy(
-            pillar=product, type=AccessPolicyType.USERDATA)
+            pillar=product, type=InformationType.USERDATA)
 
         bug = self.makeBugAndPolicies(private=True)
         task = bug.addTask(bug.owner, product)
@@ -167,19 +167,19 @@
         [artifact] = getUtility(IAccessArtifactSource).find([bug])
         self.assertEqual((1, 1), self.assertMirrored(bug))
         self.assertContentEqual(
-            [AccessPolicyType.USERDATA],
+            [InformationType.USERDATA],
             self.getPolicyTypesForArtifact(artifact))
         bug.security_related = True
         self.assertEqual((1, 1), self.assertMirrored(bug))
         self.assertContentEqual(
-            [AccessPolicyType.EMBARGOEDSECURITY],
+            [InformationType.EMBARGOEDSECURITY],
             self.getPolicyTypesForArtifact(artifact))
 
     def test_productseries_task(self):
         # A productseries task causes a link to its product's policy.
         productseries = self.factory.makeProductSeries()
         self.factory.makeAccessPolicy(
-            pillar=productseries.product, type=AccessPolicyType.USERDATA)
+            pillar=productseries.product, type=InformationType.USERDATA)
 
         bug = self.makeBugAndPolicies(private=True)
         bug.addTask(bug.owner, productseries)
@@ -192,7 +192,7 @@
         # A distribution task causes a link to its policy.
         distro = self.factory.makeDistribution()
         self.factory.makeAccessPolicy(
-            pillar=distro, type=AccessPolicyType.USERDATA)
+            pillar=distro, type=InformationType.USERDATA)
 
         bug = self.makeBugAndPolicies(private=True)
         bug.addTask(bug.owner, distro)
@@ -203,7 +203,7 @@
         # policy.
         distroseries = self.factory.makeDistroSeries()
         self.factory.makeAccessPolicy(
-            pillar=distroseries.distribution, type=AccessPolicyType.USERDATA)
+            pillar=distroseries.distribution, type=InformationType.USERDATA)
 
         bug = self.makeBugAndPolicies(private=True)
         bug.addTask(bug.owner, distroseries)

=== modified file 'lib/lp/registry/enums.py'
--- lib/lp/registry/enums.py	2012-02-28 12:16:38 +0000
+++ lib/lp/registry/enums.py	2012-03-07 00:30:25 +0000
@@ -1,13 +1,13 @@
-# Copyright 2010 Canonical Ltd.  This software is licensed under the
+# Copyright 2010-2012 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Enums for the Registry app."""
 
 __metaclass__ = type
 __all__ = [
-    'AccessPolicyType',
     'DistroSeriesDifferenceStatus',
     'DistroSeriesDifferenceType',
+    'InformationType',
     'PersonTransferJobType',
     'SharingPermission',
     ]
@@ -18,10 +18,10 @@
     )
 
 
-class AccessPolicyType(DBEnumeratedType):
-    """Access policy type.
+class InformationType(DBEnumeratedType):
+    """Information Type.
 
-    The policies used to control which users and teams can see various
+    The types used to control which users and teams can see various
     Launchpad artifacts, including bugs and branches.
     """
 
@@ -31,8 +31,8 @@
         Everyone can see this information.
         """)
 
-    PUBLICSECURITY = DBItem(2, """
-        Public Security
+    UNEMBARGOEDSECURITY = DBItem(2, """
+        Unembargoed Security
 
         Everyone can see this information pertaining to a resolved security
         related bug.

=== modified file 'lib/lp/registry/interfaces/accesspolicy.py'
--- lib/lp/registry/interfaces/accesspolicy.py	2012-02-28 12:14:41 +0000
+++ lib/lp/registry/interfaces/accesspolicy.py	2012-03-07 00:30:25 +0000
@@ -160,7 +160,7 @@
         """Create an `IAccessPolicy` for the given pillars and types.
 
         :param pillars_and_types: a collection of
-            (`IProduct` or `IDistribution`, `IAccessPolicyType`) pairs to
+            (`IProduct` or `IDistribution`, `InformationType`) pairs to
             create `IAccessPolicy` objects for.
         :return: a collection of the created `IAccessPolicy` objects.
         """
@@ -169,7 +169,7 @@
         """Return the `IAccessPolicy`s for the given pillars and types.
 
         :param pillars_and_types: a collection of
-            (`IProduct` or `IDistribution`, `IAccessPolicyType`) pairs to
+            (`IProduct` or `IDistribution`, `InformationType`) pairs to
             find.
         """
 

=== modified file 'lib/lp/registry/interfaces/accesspolicyservice.py'
--- lib/lp/registry/interfaces/accesspolicyservice.py	2012-03-01 05:50:50 +0000
+++ lib/lp/registry/interfaces/accesspolicyservice.py	2012-03-07 00:30:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2011 Canonical Ltd.  This software is licensed under the
+# Copyright 2011-2012 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Interfaces for access policy service."""
@@ -10,8 +10,6 @@
     'IAccessPolicyService',
     ]
 
-from zope.schema import Choice
-
 from lazr.restful.declarations import (
     call_with,
     export_as_webservice_entry,
@@ -22,10 +20,11 @@
     REQUEST_USER,
     )
 from lazr.restful.fields import Reference
+from zope.schema import Choice
 
 from lp import _
 from lp.app.interfaces.services import IService
-from lp.registry.enums import AccessPolicyType
+from lp.registry.enums import InformationType
 from lp.registry.interfaces.person import IPerson
 from lp.registry.interfaces.pillar import IPillar
 
@@ -55,7 +54,7 @@
     @operation_parameters(
         pillar=Reference(IPillar, title=_('Pillar'), required=True),
         observer=Reference(IPerson, title=_('Observer'), required=True),
-        access_policy_type=Choice(vocabulary=AccessPolicyType))
+        access_policy_type=Choice(vocabulary=InformationType))
     @operation_for_version('devel')
     def addPillarObserver(pillar, observer, access_policy_type, user):
         """Add an observer with the access policy to a pillar."""
@@ -64,7 +63,7 @@
     @operation_parameters(
         pillar=Reference(IPillar, title=_('Pillar'), required=True),
         observer=Reference(IPerson, title=_('Observer'), required=True),
-        access_policy_type=Choice(vocabulary=AccessPolicyType, required=False))
+        access_policy_type=Choice(vocabulary=InformationType, required=False))
     @operation_for_version('devel')
     def deletePillarObserver(pillar, observer, access_policy_type):
         """Remove an observer from a pillar.

=== modified file 'lib/lp/registry/model/accesspolicy.py'
--- lib/lp/registry/model/accesspolicy.py	2012-02-27 06:23:25 +0000
+++ lib/lp/registry/model/accesspolicy.py	2012-03-07 00:30:25 +0000
@@ -24,7 +24,7 @@
 from zope.component import getUtility
 from zope.interface import implements
 
-from lp.registry.enums import AccessPolicyType
+from lp.registry.enums import InformationType
 from lp.registry.interfaces.accesspolicy import (
     IAccessArtifact,
     IAccessArtifactGrant,
@@ -125,7 +125,7 @@
     product = Reference(product_id, 'Product.id')
     distribution_id = Int(name='distribution')
     distribution = Reference(distribution_id, 'Distribution.id')
-    type = DBEnum(allow_none=True, enum=AccessPolicyType)
+    type = DBEnum(allow_none=True, enum=InformationType)
 
     @property
     def pillar(self):

=== modified file 'lib/lp/registry/services/accesspolicyservice.py'
--- lib/lp/registry/services/accesspolicyservice.py	2012-03-05 00:42:29 +0000
+++ lib/lp/registry/services/accesspolicyservice.py	2012-03-07 00:30:25 +0000
@@ -2,7 +2,6 @@
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Classes for pillar and artifact access policy services."""
-from lp.registry.interfaces.projectgroup import IProjectGroup
 
 __metaclass__ = type
 __all__ = [
@@ -16,7 +15,7 @@
 from zope.interface import implements
 
 from lp.registry.enums import (
-    AccessPolicyType,
+    InformationType,
     SharingPermission,
     )
 from lp.registry.interfaces.accesspolicy import (
@@ -24,6 +23,7 @@
     IAccessPolicyGrantSource,
     )
 from lp.registry.interfaces.accesspolicyservice import IAccessPolicyService
+from lp.registry.interfaces.projectgroup import IProjectGroup
 from lp.services.webapp.authorization import available_with_permission
 
 
@@ -44,7 +44,7 @@
     def getAccessPolicies(self):
         """See `IAccessPolicyService`."""
         policies = []
-        for x, policy in enumerate(AccessPolicyType):
+        for x, policy in enumerate(InformationType):
             item = dict(
                 index=x,
                 value=policy.token,

=== modified file 'lib/lp/registry/services/tests/test_accesspolicyservice.py'
--- lib/lp/registry/services/tests/test_accesspolicyservice.py	2012-03-05 00:42:29 +0000
+++ lib/lp/registry/services/tests/test_accesspolicyservice.py	2012-03-07 00:30:25 +0000
@@ -4,15 +4,17 @@
 __metaclass__ = type
 
 
-import transaction
-
 from lazr.restful import EntryResource
 from lazr.restful.utils import get_current_web_service_request
+import transaction
 from zope.component import getUtility
 from zope.security.interfaces import Unauthorized
 
 from lp.app.interfaces.services import IService
-from lp.registry.enums import AccessPolicyType, SharingPermission
+from lp.registry.enums import (
+    InformationType,
+    SharingPermission,
+    )
 from lp.registry.interfaces.accesspolicy import (
     IAccessPolicyGrantSource,
     IAccessPolicySource,
@@ -26,8 +28,12 @@
     login_person,
     TestCaseWithFactory,
     WebServiceTestCase,
-    ws_object)
-from lp.testing.layers import AppServerLayer, DatabaseFunctionalLayer
+    ws_object,
+    )
+from lp.testing.layers import (
+    AppServerLayer,
+    DatabaseFunctionalLayer,
+    )
 from lp.testing.pages import LaunchpadWebServiceCaller
 
 
@@ -46,7 +52,7 @@
         resource = EntryResource(observer, request)
         observer_data = resource.toDataForJSON()
         observer_data['permissions'] = {
-            AccessPolicyType.PROPRIETARY.name: SharingPermission.ALL.name}
+            InformationType.PROPRIETARY.name: SharingPermission.ALL.name}
         return observer_data
 
     def _test_getPillarObservers(self, pillar):
@@ -96,7 +102,7 @@
     def _test_addPillarObserver(self, pillar):
         """addPillarObservers works and returns the expected data."""
         observer = self.factory.makePerson()
-        access_policy_type = AccessPolicyType.USERDATA
+        access_policy_type = InformationType.USERDATA
         user = self.factory.makePerson()
         observer_data = self.service.addPillarObserver(
             pillar, observer, access_policy_type, user)
@@ -135,7 +141,7 @@
         # addPillarObserver raises an Unauthorized exception if the user is
         # not permitted to do so.
         observer = self.factory.makePerson()
-        access_policy_type = AccessPolicyType.USERDATA
+        access_policy_type = InformationType.USERDATA
         user = self.factory.makePerson()
         self.assertRaises(
             Unauthorized, self.service.addPillarObserver,

=== modified file 'lib/lp/registry/tests/test_accesspolicy.py'
--- lib/lp/registry/tests/test_accesspolicy.py	2012-02-27 06:23:25 +0000
+++ lib/lp/registry/tests/test_accesspolicy.py	2012-03-07 00:30:25 +0000
@@ -7,7 +7,7 @@
 from testtools.matchers import AllMatch
 from zope.component import getUtility
 
-from lp.registry.enums import AccessPolicyType
+from lp.registry.enums import InformationType
 from lp.registry.interfaces.accesspolicy import (
     IAccessArtifact,
     IAccessArtifactGrant,
@@ -45,8 +45,8 @@
 
     def test_create(self):
         wanted = [
-            (self.factory.makeProduct(), AccessPolicyType.PROPRIETARY),
-            (self.factory.makeDistribution(), AccessPolicyType.USERDATA),
+            (self.factory.makeProduct(), InformationType.PROPRIETARY),
+            (self.factory.makeDistribution(), InformationType.USERDATA),
             ]
         policies = getUtility(IAccessPolicySource).create(wanted)
         self.assertThat(
@@ -63,25 +63,25 @@
         other_product = self.factory.makeProduct()
 
         wanted = [
-            (product, AccessPolicyType.PROPRIETARY),
-            (product, AccessPolicyType.USERDATA),
-            (distribution, AccessPolicyType.PROPRIETARY),
-            (distribution, AccessPolicyType.USERDATA),
-            (other_product, AccessPolicyType.PROPRIETARY),
+            (product, InformationType.PROPRIETARY),
+            (product, InformationType.USERDATA),
+            (distribution, InformationType.PROPRIETARY),
+            (distribution, InformationType.USERDATA),
+            (other_product, InformationType.PROPRIETARY),
             ]
         getUtility(IAccessPolicySource).create(wanted)
 
         query = [
-            (product, AccessPolicyType.PROPRIETARY),
-            (product, AccessPolicyType.USERDATA),
-            (distribution, AccessPolicyType.USERDATA),
+            (product, InformationType.PROPRIETARY),
+            (product, InformationType.USERDATA),
+            (distribution, InformationType.USERDATA),
             ]
         self.assertContentEqual(
             query,
             [(policy.pillar, policy.type) for policy in
              getUtility(IAccessPolicySource).find(query)])
 
-        query = [(distribution, AccessPolicyType.PROPRIETARY)]
+        query = [(distribution, InformationType.PROPRIETARY)]
         self.assertContentEqual(
             query,
             [(policy.pillar, policy.type) for policy in
@@ -103,7 +103,7 @@
         other_product = self.factory.makeProduct()
         wanted = [
             (pillar, type)
-            for type in AccessPolicyType.items
+            for type in InformationType.items
             for pillar in (product, distribution, other_product)]
         policies = getUtility(IAccessPolicySource).create(wanted)
         self.assertContentEqual(

=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py	2012-03-05 04:34:13 +0000
+++ lib/lp/scripts/garbo.py	2012-03-07 00:30:25 +0000
@@ -63,7 +63,7 @@
     RevisionCache,
     )
 from lp.hardwaredb.model.hwdb import HWSubmission
-from lp.registry.enums import AccessPolicyType
+from lp.registry.enums import InformationType
 from lp.registry.interfaces.accesspolicy import IAccessPolicySource
 from lp.registry.model.accesspolicy import AccessPolicy
 from lp.registry.model.distribution import Distribution
@@ -1026,7 +1026,7 @@
     def __call__(self, chunk_size):
         policies = itertools.product(
             self.findDistributions()[:chunk_size],
-            (AccessPolicyType.USERDATA, AccessPolicyType.EMBARGOEDSECURITY))
+            (InformationType.USERDATA, InformationType.EMBARGOEDSECURITY))
         getUtility(IAccessPolicySource).create(policies)
         self.transaction.commit()
 
@@ -1054,7 +1054,7 @@
     def __call__(self, chunk_size):
         policies = itertools.product(
             self.findProducts()[:chunk_size],
-            (AccessPolicyType.USERDATA, AccessPolicyType.EMBARGOEDSECURITY))
+            (InformationType.USERDATA, InformationType.EMBARGOEDSECURITY))
         getUtility(IAccessPolicySource).create(policies)
         self.transaction.commit()
 

=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py	2012-03-05 04:34:13 +0000
+++ lib/lp/scripts/tests/test_garbo.py	2012-03-07 00:30:25 +0000
@@ -54,7 +54,7 @@
     )
 from lp.code.model.codeimportevent import CodeImportEvent
 from lp.code.model.codeimportresult import CodeImportResult
-from lp.registry.enums import AccessPolicyType
+from lp.registry.enums import InformationType
 from lp.registry.interfaces.accesspolicy import IAccessPolicySource
 from lp.registry.interfaces.person import IPersonSet
 from lp.scripts.garbo import (
@@ -1028,7 +1028,7 @@
         self.runHourly()
         ap = getUtility(IAccessPolicySource).findByPillar((distribution,))
         expected = [
-            AccessPolicyType.USERDATA, AccessPolicyType.EMBARGOEDSECURITY]
+            InformationType.USERDATA, InformationType.EMBARGOEDSECURITY]
         self.assertContentEqual(expected, [policy.type for policy in ap])
 
     def test_AccessPolicyProductAddition(self):
@@ -1038,7 +1038,7 @@
         self.runHourly()
         ap = getUtility(IAccessPolicySource).findByPillar((product,))
         expected = [
-            AccessPolicyType.USERDATA, AccessPolicyType.EMBARGOEDSECURITY]
+            InformationType.USERDATA, InformationType.EMBARGOEDSECURITY]
         self.assertContentEqual(expected, [policy.type for policy in ap])
 
     def test_SpecificationWorkitemMigrator_not_enabled_by_default(self):

=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py	2012-03-02 16:49:21 +0000
+++ lib/lp/testing/factory.py	2012-03-07 00:30:25 +0000
@@ -139,9 +139,9 @@
     IHWSubmissionSet,
     )
 from lp.registry.enums import (
-    AccessPolicyType,
     DistroSeriesDifferenceStatus,
     DistroSeriesDifferenceType,
+    InformationType,
     )
 from lp.registry.interfaces.accesspolicy import (
     IAccessArtifactGrantSource,
@@ -4385,7 +4385,7 @@
             package_version=package_version, requester=requester)
 
     def makeAccessPolicy(self, pillar=None,
-                         type=AccessPolicyType.PROPRIETARY):
+                         type=InformationType.PROPRIETARY):
         if pillar is None:
             pillar = self.makeProduct()
         policies = getUtility(IAccessPolicySource).create([(pillar, type)])


Follow ups