Merge lp:~stevenk/launchpad/exported-policy into lp:launchpad

Proposed by Steve Kowalik on 2012-08-31
Status: Merged
Approved by: William Grant on 2012-08-31
Approved revision: no longer in the source branch.
Merged at revision: 15895
Proposed branch: lp:~stevenk/launchpad/exported-policy
Merge into: lp:launchpad
Diff against target: 158 lines (+17/-23)
4 files modified
lib/lp/bugs/interfaces/bugtarget.py (+4/-4)
lib/lp/code/model/branchnamespace.py (+7/-7)
lib/lp/registry/model/product.py (+4/-6)
lib/lp/scripts/garbo.py (+2/-6)
To merge this branch: bzr merge lp:~stevenk/launchpad/exported-policy
Reviewer Review Type Date Requested Status
William Grant code 2012-08-31 Approve on 2012-08-31
Review via email: mp+122184@code.launchpad.net

Commit Message

Rename POLICY_{ALLOWED,DEFAULT}_TYPES and POLICY_REQUIRED_GRANTS to either to start with BUG_ or BRANCH_ so they are distinguishable.

Description of the Change

Rename the two POLICY_ALLOWED_TYPES so they are distinguishable in low light conditions.

To post a comment you must log in.
William Grant (wgrant) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/interfaces/bugtarget.py'
2--- lib/lp/bugs/interfaces/bugtarget.py 2012-08-20 13:29:54 +0000
3+++ lib/lp/bugs/interfaces/bugtarget.py 2012-08-31 07:14:22 +0000
4@@ -18,8 +18,8 @@
5 'IOfficialBugTagTargetPublic',
6 'IOfficialBugTagTargetRestricted',
7 'ISeriesBugTarget',
8- 'POLICY_ALLOWED_TYPES',
9- 'POLICY_DEFAULT_TYPES',
10+ 'BUG_POLICY_ALLOWED_TYPES',
11+ 'BUG_POLICY_DEFAULT_TYPES',
12 ]
13
14
15@@ -205,14 +205,14 @@
16 vocabulary=BugBlueprintSearch, required=False))
17
18
19-POLICY_ALLOWED_TYPES = {
20+BUG_POLICY_ALLOWED_TYPES = {
21 BugSharingPolicy.PUBLIC: FREE_INFORMATION_TYPES,
22 BugSharingPolicy.PUBLIC_OR_PROPRIETARY: NON_EMBARGOED_INFORMATION_TYPES,
23 BugSharingPolicy.PROPRIETARY_OR_PUBLIC: NON_EMBARGOED_INFORMATION_TYPES,
24 BugSharingPolicy.PROPRIETARY: (InformationType.PROPRIETARY,),
25 }
26
27-POLICY_DEFAULT_TYPES = {
28+BUG_POLICY_DEFAULT_TYPES = {
29 BugSharingPolicy.PUBLIC: InformationType.PUBLIC,
30 BugSharingPolicy.PUBLIC_OR_PROPRIETARY: InformationType.PUBLIC,
31 BugSharingPolicy.PROPRIETARY_OR_PUBLIC: InformationType.PROPRIETARY,
32
33=== modified file 'lib/lp/code/model/branchnamespace.py'
34--- lib/lp/code/model/branchnamespace.py 2012-08-22 04:58:49 +0000
35+++ lib/lp/code/model/branchnamespace.py 2012-08-31 07:14:22 +0000
36@@ -8,7 +8,7 @@
37 'BranchNamespaceSet',
38 'PackageNamespace',
39 'PersonalNamespace',
40- 'POLICY_ALLOWED_TYPES',
41+ 'BRANCH_POLICY_ALLOWED_TYPES',
42 'ProductNamespace',
43 ]
44
45@@ -85,7 +85,7 @@
46 )
47
48
49-POLICY_ALLOWED_TYPES = {
50+BRANCH_POLICY_ALLOWED_TYPES = {
51 BranchSharingPolicy.PUBLIC: FREE_INFORMATION_TYPES,
52 BranchSharingPolicy.PUBLIC_OR_PROPRIETARY: NON_EMBARGOED_INFORMATION_TYPES,
53 BranchSharingPolicy.PROPRIETARY_OR_PUBLIC: (
54@@ -95,7 +95,7 @@
55 [InformationType.PROPRIETARY, InformationType.EMBARGOED],
56 }
57
58-POLICY_DEFAULT_TYPES = {
59+BRANCH_POLICY_DEFAULT_TYPES = {
60 BranchSharingPolicy.PUBLIC: InformationType.PUBLIC,
61 BranchSharingPolicy.PUBLIC_OR_PROPRIETARY: InformationType.PUBLIC,
62 BranchSharingPolicy.PROPRIETARY_OR_PUBLIC: InformationType.PROPRIETARY,
63@@ -103,7 +103,7 @@
64 BranchSharingPolicy.EMBARGOED_OR_PROPRIETARY: InformationType.EMBARGOED,
65 }
66
67-POLICY_REQUIRED_GRANTS = {
68+BRANCH_POLICY_REQUIRED_GRANTS = {
69 BranchSharingPolicy.PUBLIC: None,
70 BranchSharingPolicy.PUBLIC_OR_PROPRIETARY: None,
71 BranchSharingPolicy.PROPRIETARY_OR_PUBLIC: InformationType.PROPRIETARY,
72@@ -420,14 +420,14 @@
73 # Some policies require that the owner have full access to
74 # an information type. If it's required and the owner
75 # doesn't hold it, no information types are legal.
76- required_grant = POLICY_REQUIRED_GRANTS[
77+ required_grant = BRANCH_POLICY_REQUIRED_GRANTS[
78 self.product.branch_sharing_policy]
79 if (required_grant is not None
80 and not getUtility(IService, 'sharing').checkPillarAccess(
81 self.product, required_grant, self.owner)):
82 return []
83
84- return POLICY_ALLOWED_TYPES[
85+ return BRANCH_POLICY_ALLOWED_TYPES[
86 self.product.branch_sharing_policy]
87
88 # The project still uses BranchVisibilityPolicy, so check that.
89@@ -466,7 +466,7 @@
90 def getDefaultInformationType(self):
91 """See `IBranchNamespace`."""
92 if not self._using_branchvisibilitypolicy:
93- default_type = POLICY_DEFAULT_TYPES[
94+ default_type = BRANCH_POLICY_DEFAULT_TYPES[
95 self.product.branch_sharing_policy]
96 if default_type not in self.getAllowedInformationTypes():
97 return None
98
99=== modified file 'lib/lp/registry/model/product.py'
100--- lib/lp/registry/model/product.py 2012-08-31 04:54:24 +0000
101+++ lib/lp/registry/model/product.py 2012-08-31 07:14:22 +0000
102@@ -91,8 +91,8 @@
103 from lp.bugs.interfaces.bugsummary import IBugSummaryDimension
104 from lp.bugs.interfaces.bugsupervisor import IHasBugSupervisor
105 from lp.bugs.interfaces.bugtarget import (
106- POLICY_ALLOWED_TYPES as BUG_POLICY_ALLOWED_TYPES,
107- POLICY_DEFAULT_TYPES,
108+ BUG_POLICY_ALLOWED_TYPES,
109+ BUG_POLICY_DEFAULT_TYPES,
110 )
111 from lp.bugs.interfaces.bugtaskfilter import OrderedBugTask
112 from lp.bugs.model.bugtarget import (
113@@ -107,9 +107,7 @@
114 )
115 from lp.code.enums import BranchType
116 from lp.code.interfaces.branch import DEFAULT_BRANCH_STATUS_IN_LISTING
117-from lp.code.model.branchnamespace import (
118- POLICY_ALLOWED_TYPES as BRANCH_POLICY_ALLOWED_TYPES,
119- )
120+from lp.code.model.branchnamespace import BRANCH_POLICY_ALLOWED_TYPES
121 from lp.code.model.branchvisibilitypolicy import BranchVisibilityPolicyMixin
122 from lp.code.model.hasbranches import (
123 HasBranchesMixin,
124@@ -597,7 +595,7 @@
125 def getDefaultBugInformationType(self):
126 """See `IDistribution.`"""
127 if self.bug_sharing_policy is not None:
128- return POLICY_DEFAULT_TYPES[self.bug_sharing_policy]
129+ return BUG_POLICY_DEFAULT_TYPES[self.bug_sharing_policy]
130 elif self.private_bugs:
131 return InformationType.USERDATA
132 else:
133
134=== modified file 'lib/lp/scripts/garbo.py'
135--- lib/lp/scripts/garbo.py 2012-08-29 14:16:30 +0000
136+++ lib/lp/scripts/garbo.py 2012-08-31 07:14:22 +0000
137@@ -47,9 +47,7 @@
138
139 from lp.answers.model.answercontact import AnswerContact
140 from lp.bugs.interfaces.bug import IBugSet
141-from lp.bugs.interfaces.bugtarget import (
142- POLICY_ALLOWED_TYPES as BUG_POLICY_ALLOWED_TYPES,
143- )
144+from lp.bugs.interfaces.bugtarget import BUG_POLICY_ALLOWED_TYPES
145 from lp.bugs.model.bug import Bug
146 from lp.bugs.model.bugattachment import BugAttachment
147 from lp.bugs.model.bugnotification import BugNotification
148@@ -60,9 +58,7 @@
149 )
150 from lp.code.enums import BranchVisibilityRule
151 from lp.code.interfaces.revision import IRevisionSet
152-from lp.code.model.branchnamespace import (
153- POLICY_ALLOWED_TYPES as BRANCH_POLICY_ALLOWED_TYPES,
154- )
155+from lp.code.model.branchnamespace import BRANCH_POLICY_ALLOWED_TYPES
156 from lp.code.model.branchvisibilitypolicy import BranchVisibilityTeamPolicy
157 from lp.code.model.codeimportevent import CodeImportEvent
158 from lp.code.model.codeimportresult import CodeImportResult