Merge lp:~stevenk/launchpad/move-to-informationtype into lp:launchpad
- move-to-informationtype
- Merge into devel
Proposed by
Steve Kowalik
on 2012-03-07
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Steve Kowalik on 2012-03-07 | ||||
| Approved revision: | no longer in the source branch. | ||||
| Merged at revision: | 14911 | ||||
| Proposed branch: | lp:~stevenk/launchpad/move-to-informationtype | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
573 lines (+82/-78) 12 files modified
lib/canonical/launchpad/icing/css/colours.css (+1/-1) lib/lp/bugs/tests/test_bug_mirror_access_triggers.py (+12/-12) lib/lp/registry/enums.py (+7/-7) lib/lp/registry/interfaces/accesspolicy.py (+2/-2) lib/lp/registry/interfaces/accesspolicyservice.py (+8/-9) lib/lp/registry/model/accesspolicy.py (+2/-2) lib/lp/registry/services/accesspolicyservice.py (+4/-5) lib/lp/registry/services/tests/test_accesspolicyservice.py (+25/-19) lib/lp/registry/tests/test_accesspolicy.py (+13/-13) lib/lp/scripts/garbo.py (+3/-3) lib/lp/scripts/tests/test_garbo.py (+3/-3) lib/lp/testing/factory.py (+2/-2) |
||||
| To merge this branch: | bzr merge lp:~stevenk/launchpad/move-to-informationtype | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Ian Booth (community) | 2012-03-07 | Approve on 2012-03-07 | |
|
Review via email:
|
|||
Commit Message
[r=wallyworld][bug=948083][no-qa][incr] Rename AccessPolicyType to InformationType, and PUBLICSECURITY to UNEMBARGOEDSECU
Description of the Change
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 -> UNEMBARGOEDSECU
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
| 1 | === modified file 'lib/canonical/launchpad/icing/css/colours.css' |
| 2 | --- lib/canonical/launchpad/icing/css/colours.css 2012-02-22 05:22:13 +0000 |
| 3 | +++ lib/canonical/launchpad/icing/css/colours.css 2012-03-07 02:09:20 +0000 |
| 4 | @@ -351,7 +351,7 @@ |
| 5 | color: green; |
| 6 | } |
| 7 | |
| 8 | -.accessPolicyPUBLICSECURITY, .accessPolicyPUBLICSECURITY a { |
| 9 | +.accessPolicyUNEMBARGOEDSECURITY, .accessPolicyUNEMBARGOEDSECURITY a { |
| 10 | color: #1f7dff; |
| 11 | } |
| 12 | |
| 13 | |
| 14 | === modified file 'lib/lp/bugs/tests/test_bug_mirror_access_triggers.py' |
| 15 | --- lib/lp/bugs/tests/test_bug_mirror_access_triggers.py 2012-02-27 06:04:25 +0000 |
| 16 | +++ lib/lp/bugs/tests/test_bug_mirror_access_triggers.py 2012-03-07 02:09:20 +0000 |
| 17 | @@ -11,12 +11,12 @@ |
| 18 | from zope.component import getUtility |
| 19 | from zope.security.proxy import removeSecurityProxy |
| 20 | |
| 21 | -from lp.registry.enums import AccessPolicyType |
| 22 | +from lp.registry.enums import InformationType |
| 23 | from lp.registry.interfaces.accesspolicy import ( |
| 24 | IAccessArtifactGrantSource, |
| 25 | IAccessArtifactSource, |
| 26 | + IAccessPolicyArtifactSource, |
| 27 | IAccessPolicySource, |
| 28 | - IAccessPolicyArtifactSource, |
| 29 | ) |
| 30 | from lp.services.features.testing import FeatureFixture |
| 31 | from lp.testing import TestCaseWithFactory |
| 32 | @@ -57,9 +57,9 @@ |
| 33 | grant_count = len(grants) |
| 34 | |
| 35 | if removeSecurityProxy(bug).security_related: |
| 36 | - policy_type = AccessPolicyType.EMBARGOEDSECURITY |
| 37 | + policy_type = InformationType.EMBARGOEDSECURITY |
| 38 | else: |
| 39 | - policy_type = AccessPolicyType.USERDATA |
| 40 | + policy_type = InformationType.USERDATA |
| 41 | |
| 42 | # Get the relevant access policies, confirming that there's one |
| 43 | # for every pillar. |
| 44 | @@ -81,7 +81,7 @@ |
| 45 | def makeBugAndPolicies(self, private=False, policy_types=None): |
| 46 | if policy_types is None: |
| 47 | policy_types = [ |
| 48 | - AccessPolicyType.USERDATA, AccessPolicyType.EMBARGOEDSECURITY] |
| 49 | + InformationType.USERDATA, InformationType.EMBARGOEDSECURITY] |
| 50 | product = self.factory.makeProduct() |
| 51 | for policy_type in policy_types: |
| 52 | self.factory.makeAccessPolicy(pillar=product, type=policy_type) |
| 53 | @@ -125,7 +125,7 @@ |
| 54 | # Adding a task on a new product links its policy. |
| 55 | product = self.factory.makeProduct() |
| 56 | self.factory.makeAccessPolicy( |
| 57 | - pillar=product, type=AccessPolicyType.USERDATA) |
| 58 | + pillar=product, type=InformationType.USERDATA) |
| 59 | |
| 60 | bug = self.makeBugAndPolicies(private=True) |
| 61 | bug.addTask(bug.owner, product) |
| 62 | @@ -135,7 +135,7 @@ |
| 63 | # Removing a task removes its policy. |
| 64 | product = self.factory.makeProduct() |
| 65 | self.factory.makeAccessPolicy( |
| 66 | - pillar=product, type=AccessPolicyType.USERDATA) |
| 67 | + pillar=product, type=InformationType.USERDATA) |
| 68 | |
| 69 | bug = self.makeBugAndPolicies(private=True) |
| 70 | task = bug.addTask(bug.owner, product) |
| 71 | @@ -167,19 +167,19 @@ |
| 72 | [artifact] = getUtility(IAccessArtifactSource).find([bug]) |
| 73 | self.assertEqual((1, 1), self.assertMirrored(bug)) |
| 74 | self.assertContentEqual( |
| 75 | - [AccessPolicyType.USERDATA], |
| 76 | + [InformationType.USERDATA], |
| 77 | self.getPolicyTypesForArtifact(artifact)) |
| 78 | bug.security_related = True |
| 79 | self.assertEqual((1, 1), self.assertMirrored(bug)) |
| 80 | self.assertContentEqual( |
| 81 | - [AccessPolicyType.EMBARGOEDSECURITY], |
| 82 | + [InformationType.EMBARGOEDSECURITY], |
| 83 | self.getPolicyTypesForArtifact(artifact)) |
| 84 | |
| 85 | def test_productseries_task(self): |
| 86 | # A productseries task causes a link to its product's policy. |
| 87 | productseries = self.factory.makeProductSeries() |
| 88 | self.factory.makeAccessPolicy( |
| 89 | - pillar=productseries.product, type=AccessPolicyType.USERDATA) |
| 90 | + pillar=productseries.product, type=InformationType.USERDATA) |
| 91 | |
| 92 | bug = self.makeBugAndPolicies(private=True) |
| 93 | bug.addTask(bug.owner, productseries) |
| 94 | @@ -192,7 +192,7 @@ |
| 95 | # A distribution task causes a link to its policy. |
| 96 | distro = self.factory.makeDistribution() |
| 97 | self.factory.makeAccessPolicy( |
| 98 | - pillar=distro, type=AccessPolicyType.USERDATA) |
| 99 | + pillar=distro, type=InformationType.USERDATA) |
| 100 | |
| 101 | bug = self.makeBugAndPolicies(private=True) |
| 102 | bug.addTask(bug.owner, distro) |
| 103 | @@ -203,7 +203,7 @@ |
| 104 | # policy. |
| 105 | distroseries = self.factory.makeDistroSeries() |
| 106 | self.factory.makeAccessPolicy( |
| 107 | - pillar=distroseries.distribution, type=AccessPolicyType.USERDATA) |
| 108 | + pillar=distroseries.distribution, type=InformationType.USERDATA) |
| 109 | |
| 110 | bug = self.makeBugAndPolicies(private=True) |
| 111 | bug.addTask(bug.owner, distroseries) |
| 112 | |
| 113 | === modified file 'lib/lp/registry/enums.py' |
| 114 | --- lib/lp/registry/enums.py 2012-02-28 12:16:38 +0000 |
| 115 | +++ lib/lp/registry/enums.py 2012-03-07 02:09:20 +0000 |
| 116 | @@ -1,13 +1,13 @@ |
| 117 | -# Copyright 2010 Canonical Ltd. This software is licensed under the |
| 118 | +# Copyright 2010-2012 Canonical Ltd. This software is licensed under the |
| 119 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 120 | |
| 121 | """Enums for the Registry app.""" |
| 122 | |
| 123 | __metaclass__ = type |
| 124 | __all__ = [ |
| 125 | - 'AccessPolicyType', |
| 126 | 'DistroSeriesDifferenceStatus', |
| 127 | 'DistroSeriesDifferenceType', |
| 128 | + 'InformationType', |
| 129 | 'PersonTransferJobType', |
| 130 | 'SharingPermission', |
| 131 | ] |
| 132 | @@ -18,10 +18,10 @@ |
| 133 | ) |
| 134 | |
| 135 | |
| 136 | -class AccessPolicyType(DBEnumeratedType): |
| 137 | - """Access policy type. |
| 138 | +class InformationType(DBEnumeratedType): |
| 139 | + """Information Type. |
| 140 | |
| 141 | - The policies used to control which users and teams can see various |
| 142 | + The types used to control which users and teams can see various |
| 143 | Launchpad artifacts, including bugs and branches. |
| 144 | """ |
| 145 | |
| 146 | @@ -31,8 +31,8 @@ |
| 147 | Everyone can see this information. |
| 148 | """) |
| 149 | |
| 150 | - PUBLICSECURITY = DBItem(2, """ |
| 151 | - Public Security |
| 152 | + UNEMBARGOEDSECURITY = DBItem(2, """ |
| 153 | + Unembargoed Security |
| 154 | |
| 155 | Everyone can see this information pertaining to a resolved security |
| 156 | related bug. |
| 157 | |
| 158 | === modified file 'lib/lp/registry/interfaces/accesspolicy.py' |
| 159 | --- lib/lp/registry/interfaces/accesspolicy.py 2012-03-06 12:03:09 +0000 |
| 160 | +++ lib/lp/registry/interfaces/accesspolicy.py 2012-03-07 02:09:20 +0000 |
| 161 | @@ -160,7 +160,7 @@ |
| 162 | """Create an `IAccessPolicy` for the given pillars and types. |
| 163 | |
| 164 | :param pillars_and_types: a collection of |
| 165 | - (`IProduct` or `IDistribution`, `IAccessPolicyType`) pairs to |
| 166 | + (`IProduct` or `IDistribution`, `InformationType`) pairs to |
| 167 | create `IAccessPolicy` objects for. |
| 168 | :return: a collection of the created `IAccessPolicy` objects. |
| 169 | """ |
| 170 | @@ -169,7 +169,7 @@ |
| 171 | """Return the `IAccessPolicy`s for the given pillars and types. |
| 172 | |
| 173 | :param pillars_and_types: a collection of |
| 174 | - (`IProduct` or `IDistribution`, `IAccessPolicyType`) pairs to |
| 175 | + (`IProduct` or `IDistribution`, `InformationType`) pairs to |
| 176 | find. |
| 177 | """ |
| 178 | |
| 179 | |
| 180 | === modified file 'lib/lp/registry/interfaces/accesspolicyservice.py' |
| 181 | --- lib/lp/registry/interfaces/accesspolicyservice.py 2012-03-06 12:03:09 +0000 |
| 182 | +++ lib/lp/registry/interfaces/accesspolicyservice.py 2012-03-07 02:09:20 +0000 |
| 183 | @@ -1,4 +1,4 @@ |
| 184 | -# Copyright 2011 Canonical Ltd. This software is licensed under the |
| 185 | +# Copyright 2011-2012 Canonical Ltd. This software is licensed under the |
| 186 | # GNU Affero General Public License version 3 (see the file LICENSE). |
| 187 | |
| 188 | """Interfaces for access policy service.""" |
| 189 | @@ -10,11 +10,6 @@ |
| 190 | 'IAccessPolicyService', |
| 191 | ] |
| 192 | |
| 193 | -from zope.schema import ( |
| 194 | - Choice, |
| 195 | - List, |
| 196 | - ) |
| 197 | - |
| 198 | from lazr.restful.declarations import ( |
| 199 | call_with, |
| 200 | export_as_webservice_entry, |
| 201 | @@ -25,10 +20,14 @@ |
| 202 | REQUEST_USER, |
| 203 | ) |
| 204 | from lazr.restful.fields import Reference |
| 205 | +from zope.schema import ( |
| 206 | + Choice, |
| 207 | + List, |
| 208 | + ) |
| 209 | |
| 210 | from lp import _ |
| 211 | from lp.app.interfaces.services import IService |
| 212 | -from lp.registry.enums import AccessPolicyType |
| 213 | +from lp.registry.enums import InformationType |
| 214 | from lp.registry.interfaces.person import IPerson |
| 215 | from lp.registry.interfaces.pillar import IPillar |
| 216 | |
| 217 | @@ -58,7 +57,7 @@ |
| 218 | @operation_parameters( |
| 219 | pillar=Reference(IPillar, title=_('Pillar'), required=True), |
| 220 | observer=Reference(IPerson, title=_('Observer'), required=True), |
| 221 | - access_policy_types=List(Choice(vocabulary=AccessPolicyType))) |
| 222 | + access_policy_types=List(Choice(vocabulary=InformationType))) |
| 223 | @operation_for_version('devel') |
| 224 | def updatePillarObserver(pillar, observer, access_policy_types, user): |
| 225 | """Ensure observer has the grants for access policies on a pillar.""" |
| 226 | @@ -67,7 +66,7 @@ |
| 227 | @operation_parameters( |
| 228 | pillar=Reference(IPillar, title=_('Pillar'), required=True), |
| 229 | observer=Reference(IPerson, title=_('Observer'), required=True), |
| 230 | - access_policy_type=Choice(vocabulary=AccessPolicyType, required=False)) |
| 231 | + access_policy_type=Choice(vocabulary=InformationType, required=False)) |
| 232 | @operation_for_version('devel') |
| 233 | def deletePillarObserver(pillar, observer, access_policy_type): |
| 234 | """Remove an observer from a pillar. |
| 235 | |
| 236 | === modified file 'lib/lp/registry/model/accesspolicy.py' |
| 237 | --- lib/lp/registry/model/accesspolicy.py 2012-03-06 12:03:09 +0000 |
| 238 | +++ lib/lp/registry/model/accesspolicy.py 2012-03-07 02:09:20 +0000 |
| 239 | @@ -24,7 +24,7 @@ |
| 240 | from zope.component import getUtility |
| 241 | from zope.interface import implements |
| 242 | |
| 243 | -from lp.registry.enums import AccessPolicyType |
| 244 | +from lp.registry.enums import InformationType |
| 245 | from lp.registry.interfaces.accesspolicy import ( |
| 246 | IAccessArtifact, |
| 247 | IAccessArtifactGrant, |
| 248 | @@ -125,7 +125,7 @@ |
| 249 | product = Reference(product_id, 'Product.id') |
| 250 | distribution_id = Int(name='distribution') |
| 251 | distribution = Reference(distribution_id, 'Distribution.id') |
| 252 | - type = DBEnum(allow_none=True, enum=AccessPolicyType) |
| 253 | + type = DBEnum(allow_none=True, enum=InformationType) |
| 254 | |
| 255 | @property |
| 256 | def pillar(self): |
| 257 | |
| 258 | === modified file 'lib/lp/registry/services/accesspolicyservice.py' |
| 259 | --- lib/lp/registry/services/accesspolicyservice.py 2012-03-06 20:58:51 +0000 |
| 260 | +++ lib/lp/registry/services/accesspolicyservice.py 2012-03-07 02:09:20 +0000 |
| 261 | @@ -15,7 +15,7 @@ |
| 262 | from zope.interface import implements |
| 263 | |
| 264 | from lp.registry.enums import ( |
| 265 | - AccessPolicyType, |
| 266 | + InformationType, |
| 267 | SharingPermission, |
| 268 | ) |
| 269 | from lp.registry.interfaces.accesspolicy import ( |
| 270 | @@ -44,15 +44,14 @@ |
| 271 | |
| 272 | def getAccessPolicies(self, pillar): |
| 273 | """See `IAccessPolicyService`.""" |
| 274 | - |
| 275 | allowed_policy_types = [ |
| 276 | - AccessPolicyType.EMBARGOEDSECURITY, |
| 277 | - AccessPolicyType.USERDATA] |
| 278 | + InformationType.EMBARGOEDSECURITY, |
| 279 | + InformationType.USERDATA] |
| 280 | # Products with current commercial subscriptions are also allowed to |
| 281 | # have a PROPRIETARY access policy. |
| 282 | if (IProduct.providedBy(pillar) and |
| 283 | pillar.has_current_commercial_subscription): |
| 284 | - allowed_policy_types.append(AccessPolicyType.PROPRIETARY) |
| 285 | + allowed_policy_types.append(InformationType.PROPRIETARY) |
| 286 | |
| 287 | policies_data = [] |
| 288 | for x, policy in enumerate(allowed_policy_types): |
| 289 | |
| 290 | === modified file 'lib/lp/registry/services/tests/test_accesspolicyservice.py' |
| 291 | --- lib/lp/registry/services/tests/test_accesspolicyservice.py 2012-03-06 12:03:09 +0000 |
| 292 | +++ lib/lp/registry/services/tests/test_accesspolicyservice.py 2012-03-07 02:09:20 +0000 |
| 293 | @@ -4,15 +4,17 @@ |
| 294 | __metaclass__ = type |
| 295 | |
| 296 | |
| 297 | -import transaction |
| 298 | - |
| 299 | from lazr.restful import EntryResource |
| 300 | from lazr.restful.utils import get_current_web_service_request |
| 301 | +import transaction |
| 302 | from zope.component import getUtility |
| 303 | from zope.security.interfaces import Unauthorized |
| 304 | |
| 305 | from lp.app.interfaces.services import IService |
| 306 | -from lp.registry.enums import AccessPolicyType, SharingPermission |
| 307 | +from lp.registry.enums import ( |
| 308 | + InformationType, |
| 309 | + SharingPermission, |
| 310 | + ) |
| 311 | from lp.registry.interfaces.accesspolicy import ( |
| 312 | IAccessPolicyGrantSource, |
| 313 | IAccessPolicySource, |
| 314 | @@ -26,8 +28,12 @@ |
| 315 | login_person, |
| 316 | TestCaseWithFactory, |
| 317 | WebServiceTestCase, |
| 318 | - ws_object) |
| 319 | -from lp.testing.layers import AppServerLayer, DatabaseFunctionalLayer |
| 320 | + ws_object, |
| 321 | + ) |
| 322 | +from lp.testing.layers import ( |
| 323 | + AppServerLayer, |
| 324 | + DatabaseFunctionalLayer, |
| 325 | + ) |
| 326 | from lp.testing.pages import LaunchpadWebServiceCaller |
| 327 | |
| 328 | |
| 329 | @@ -68,40 +74,40 @@ |
| 330 | product = self.factory.makeProduct() |
| 331 | self._test_getAccessPolicies( |
| 332 | product, |
| 333 | - [AccessPolicyType.EMBARGOEDSECURITY, AccessPolicyType.USERDATA]) |
| 334 | + [InformationType.EMBARGOEDSECURITY, InformationType.USERDATA]) |
| 335 | |
| 336 | def test_getAccessPolicies_expired_commercial_product(self): |
| 337 | product = self.factory.makeProduct() |
| 338 | self.factory.makeCommercialSubscription(product, expired=True) |
| 339 | self._test_getAccessPolicies( |
| 340 | product, |
| 341 | - [AccessPolicyType.EMBARGOEDSECURITY, AccessPolicyType.USERDATA]) |
| 342 | + [InformationType.EMBARGOEDSECURITY, InformationType.USERDATA]) |
| 343 | |
| 344 | def test_getAccessPolicies_commercial_product(self): |
| 345 | product = self.factory.makeProduct() |
| 346 | self.factory.makeCommercialSubscription(product) |
| 347 | self._test_getAccessPolicies( |
| 348 | product, |
| 349 | - [AccessPolicyType.EMBARGOEDSECURITY, |
| 350 | - AccessPolicyType.USERDATA, |
| 351 | - AccessPolicyType.PROPRIETARY]) |
| 352 | + [InformationType.EMBARGOEDSECURITY, |
| 353 | + InformationType.USERDATA, |
| 354 | + InformationType.PROPRIETARY]) |
| 355 | |
| 356 | def test_getAccessPolicies_distro(self): |
| 357 | distro = self.factory.makeDistribution() |
| 358 | self._test_getAccessPolicies( |
| 359 | distro, |
| 360 | - [AccessPolicyType.EMBARGOEDSECURITY, AccessPolicyType.USERDATA]) |
| 361 | + [InformationType.EMBARGOEDSECURITY, InformationType.USERDATA]) |
| 362 | |
| 363 | def _test_getPillarObservers(self, pillar): |
| 364 | # getPillarObservers returns the expected data. |
| 365 | access_policy = self.factory.makeAccessPolicy( |
| 366 | pillar=pillar, |
| 367 | - type=AccessPolicyType.PROPRIETARY) |
| 368 | + type=InformationType.PROPRIETARY) |
| 369 | grantee = self.factory.makePerson() |
| 370 | self.factory.makeAccessPolicyGrant(access_policy, grantee) |
| 371 | [observer] = self.service.getPillarObservers(pillar) |
| 372 | person_data = self._makeObserverData( |
| 373 | - grantee, [AccessPolicyType.PROPRIETARY]) |
| 374 | + grantee, [InformationType.PROPRIETARY]) |
| 375 | self.assertEqual(person_data, observer) |
| 376 | |
| 377 | def test_getProductObservers(self): |
| 378 | @@ -148,19 +154,19 @@ |
| 379 | # cases correctly. |
| 380 | # First, a grant that is in the add set - it wil be retained. |
| 381 | policy = self.factory.makeAccessPolicy( |
| 382 | - pillar=pillar, type=AccessPolicyType.EMBARGOEDSECURITY) |
| 383 | + pillar=pillar, type=InformationType.EMBARGOEDSECURITY) |
| 384 | self.factory.makeAccessPolicyGrant( |
| 385 | policy, grantee=observer, grantor=grantor) |
| 386 | # Second, a grant that is not in the add set - it will be deleted. |
| 387 | policy = self.factory.makeAccessPolicy( |
| 388 | - pillar=pillar, type=AccessPolicyType.PROPRIETARY) |
| 389 | + pillar=pillar, type=InformationType.PROPRIETARY) |
| 390 | self.factory.makeAccessPolicyGrant( |
| 391 | policy, grantee=observer, grantor=grantor) |
| 392 | |
| 393 | # Now call updatePillarObserver will the grants we want. |
| 394 | access_policy_types = [ |
| 395 | - AccessPolicyType.EMBARGOEDSECURITY, |
| 396 | - AccessPolicyType.USERDATA] |
| 397 | + InformationType.EMBARGOEDSECURITY, |
| 398 | + InformationType.USERDATA] |
| 399 | observer_data = self.service.updatePillarObserver( |
| 400 | pillar, observer, access_policy_types, grantor) |
| 401 | policies = getUtility(IAccessPolicySource).findByPillar([pillar]) |
| 402 | @@ -183,7 +189,7 @@ |
| 403 | login_person(owner) |
| 404 | self.assertRaises( |
| 405 | AssertionError, self.service.updatePillarObserver, |
| 406 | - project_group, observer, [AccessPolicyType.USERDATA], owner) |
| 407 | + project_group, observer, [InformationType.USERDATA], owner) |
| 408 | |
| 409 | def test_updateProductObserver(self): |
| 410 | # Users with launchpad.Edit can add observers. |
| 411 | @@ -203,7 +209,7 @@ |
| 412 | # updatePillarObserver raises an Unauthorized exception if the user is |
| 413 | # not permitted to do so. |
| 414 | observer = self.factory.makePerson() |
| 415 | - access_policy_type = AccessPolicyType.USERDATA |
| 416 | + access_policy_type = InformationType.USERDATA |
| 417 | user = self.factory.makePerson() |
| 418 | self.assertRaises( |
| 419 | Unauthorized, self.service.updatePillarObserver, |
| 420 | |
| 421 | === modified file 'lib/lp/registry/tests/test_accesspolicy.py' |
| 422 | --- lib/lp/registry/tests/test_accesspolicy.py 2012-03-06 12:03:09 +0000 |
| 423 | +++ lib/lp/registry/tests/test_accesspolicy.py 2012-03-07 02:09:20 +0000 |
| 424 | @@ -7,7 +7,7 @@ |
| 425 | from testtools.matchers import AllMatch |
| 426 | from zope.component import getUtility |
| 427 | |
| 428 | -from lp.registry.enums import AccessPolicyType |
| 429 | +from lp.registry.enums import InformationType |
| 430 | from lp.registry.interfaces.accesspolicy import ( |
| 431 | IAccessArtifact, |
| 432 | IAccessArtifactGrant, |
| 433 | @@ -45,8 +45,8 @@ |
| 434 | |
| 435 | def test_create(self): |
| 436 | wanted = [ |
| 437 | - (self.factory.makeProduct(), AccessPolicyType.PROPRIETARY), |
| 438 | - (self.factory.makeDistribution(), AccessPolicyType.USERDATA), |
| 439 | + (self.factory.makeProduct(), InformationType.PROPRIETARY), |
| 440 | + (self.factory.makeDistribution(), InformationType.USERDATA), |
| 441 | ] |
| 442 | policies = getUtility(IAccessPolicySource).create(wanted) |
| 443 | self.assertThat( |
| 444 | @@ -63,25 +63,25 @@ |
| 445 | other_product = self.factory.makeProduct() |
| 446 | |
| 447 | wanted = [ |
| 448 | - (product, AccessPolicyType.PROPRIETARY), |
| 449 | - (product, AccessPolicyType.USERDATA), |
| 450 | - (distribution, AccessPolicyType.PROPRIETARY), |
| 451 | - (distribution, AccessPolicyType.USERDATA), |
| 452 | - (other_product, AccessPolicyType.PROPRIETARY), |
| 453 | + (product, InformationType.PROPRIETARY), |
| 454 | + (product, InformationType.USERDATA), |
| 455 | + (distribution, InformationType.PROPRIETARY), |
| 456 | + (distribution, InformationType.USERDATA), |
| 457 | + (other_product, InformationType.PROPRIETARY), |
| 458 | ] |
| 459 | getUtility(IAccessPolicySource).create(wanted) |
| 460 | |
| 461 | query = [ |
| 462 | - (product, AccessPolicyType.PROPRIETARY), |
| 463 | - (product, AccessPolicyType.USERDATA), |
| 464 | - (distribution, AccessPolicyType.USERDATA), |
| 465 | + (product, InformationType.PROPRIETARY), |
| 466 | + (product, InformationType.USERDATA), |
| 467 | + (distribution, InformationType.USERDATA), |
| 468 | ] |
| 469 | self.assertContentEqual( |
| 470 | query, |
| 471 | [(policy.pillar, policy.type) for policy in |
| 472 | getUtility(IAccessPolicySource).find(query)]) |
| 473 | |
| 474 | - query = [(distribution, AccessPolicyType.PROPRIETARY)] |
| 475 | + query = [(distribution, InformationType.PROPRIETARY)] |
| 476 | self.assertContentEqual( |
| 477 | query, |
| 478 | [(policy.pillar, policy.type) for policy in |
| 479 | @@ -103,7 +103,7 @@ |
| 480 | other_product = self.factory.makeProduct() |
| 481 | wanted = [ |
| 482 | (pillar, type) |
| 483 | - for type in AccessPolicyType.items |
| 484 | + for type in InformationType.items |
| 485 | for pillar in (product, distribution, other_product)] |
| 486 | policies = getUtility(IAccessPolicySource).create(wanted) |
| 487 | self.assertContentEqual( |
| 488 | |
| 489 | === modified file 'lib/lp/scripts/garbo.py' |
| 490 | --- lib/lp/scripts/garbo.py 2012-03-05 04:34:13 +0000 |
| 491 | +++ lib/lp/scripts/garbo.py 2012-03-07 02:09:20 +0000 |
| 492 | @@ -63,7 +63,7 @@ |
| 493 | RevisionCache, |
| 494 | ) |
| 495 | from lp.hardwaredb.model.hwdb import HWSubmission |
| 496 | -from lp.registry.enums import AccessPolicyType |
| 497 | +from lp.registry.enums import InformationType |
| 498 | from lp.registry.interfaces.accesspolicy import IAccessPolicySource |
| 499 | from lp.registry.model.accesspolicy import AccessPolicy |
| 500 | from lp.registry.model.distribution import Distribution |
| 501 | @@ -1026,7 +1026,7 @@ |
| 502 | def __call__(self, chunk_size): |
| 503 | policies = itertools.product( |
| 504 | self.findDistributions()[:chunk_size], |
| 505 | - (AccessPolicyType.USERDATA, AccessPolicyType.EMBARGOEDSECURITY)) |
| 506 | + (InformationType.USERDATA, InformationType.EMBARGOEDSECURITY)) |
| 507 | getUtility(IAccessPolicySource).create(policies) |
| 508 | self.transaction.commit() |
| 509 | |
| 510 | @@ -1054,7 +1054,7 @@ |
| 511 | def __call__(self, chunk_size): |
| 512 | policies = itertools.product( |
| 513 | self.findProducts()[:chunk_size], |
| 514 | - (AccessPolicyType.USERDATA, AccessPolicyType.EMBARGOEDSECURITY)) |
| 515 | + (InformationType.USERDATA, InformationType.EMBARGOEDSECURITY)) |
| 516 | getUtility(IAccessPolicySource).create(policies) |
| 517 | self.transaction.commit() |
| 518 | |
| 519 | |
| 520 | === modified file 'lib/lp/scripts/tests/test_garbo.py' |
| 521 | --- lib/lp/scripts/tests/test_garbo.py 2012-03-05 04:34:13 +0000 |
| 522 | +++ lib/lp/scripts/tests/test_garbo.py 2012-03-07 02:09:20 +0000 |
| 523 | @@ -54,7 +54,7 @@ |
| 524 | ) |
| 525 | from lp.code.model.codeimportevent import CodeImportEvent |
| 526 | from lp.code.model.codeimportresult import CodeImportResult |
| 527 | -from lp.registry.enums import AccessPolicyType |
| 528 | +from lp.registry.enums import InformationType |
| 529 | from lp.registry.interfaces.accesspolicy import IAccessPolicySource |
| 530 | from lp.registry.interfaces.person import IPersonSet |
| 531 | from lp.scripts.garbo import ( |
| 532 | @@ -1028,7 +1028,7 @@ |
| 533 | self.runHourly() |
| 534 | ap = getUtility(IAccessPolicySource).findByPillar((distribution,)) |
| 535 | expected = [ |
| 536 | - AccessPolicyType.USERDATA, AccessPolicyType.EMBARGOEDSECURITY] |
| 537 | + InformationType.USERDATA, InformationType.EMBARGOEDSECURITY] |
| 538 | self.assertContentEqual(expected, [policy.type for policy in ap]) |
| 539 | |
| 540 | def test_AccessPolicyProductAddition(self): |
| 541 | @@ -1038,7 +1038,7 @@ |
| 542 | self.runHourly() |
| 543 | ap = getUtility(IAccessPolicySource).findByPillar((product,)) |
| 544 | expected = [ |
| 545 | - AccessPolicyType.USERDATA, AccessPolicyType.EMBARGOEDSECURITY] |
| 546 | + InformationType.USERDATA, InformationType.EMBARGOEDSECURITY] |
| 547 | self.assertContentEqual(expected, [policy.type for policy in ap]) |
| 548 | |
| 549 | def test_SpecificationWorkitemMigrator_not_enabled_by_default(self): |
| 550 | |
| 551 | === modified file 'lib/lp/testing/factory.py' |
| 552 | --- lib/lp/testing/factory.py 2012-03-02 16:49:21 +0000 |
| 553 | +++ lib/lp/testing/factory.py 2012-03-07 02:09:20 +0000 |
| 554 | @@ -139,9 +139,9 @@ |
| 555 | IHWSubmissionSet, |
| 556 | ) |
| 557 | from lp.registry.enums import ( |
| 558 | - AccessPolicyType, |
| 559 | DistroSeriesDifferenceStatus, |
| 560 | DistroSeriesDifferenceType, |
| 561 | + InformationType, |
| 562 | ) |
| 563 | from lp.registry.interfaces.accesspolicy import ( |
| 564 | IAccessArtifactGrantSource, |
| 565 | @@ -4385,7 +4385,7 @@ |
| 566 | package_version=package_version, requester=requester) |
| 567 | |
| 568 | def makeAccessPolicy(self, pillar=None, |
| 569 | - type=AccessPolicyType.PROPRIETARY): |
| 570 | + type=InformationType.PROPRIETARY): |
| 571 | if pillar is None: |
| 572 | pillar = self.makeProduct() |
| 573 | policies = getUtility(IAccessPolicySource).create([(pillar, type)]) |

This looks good. Thanks for the drive-by.