Merge lp:~stevenk/launchpad/branches-are-more-than-private into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: Steve Kowalik
Approved revision: no longer in the source branch.
Merged at revision: 15900
Proposed branch: lp:~stevenk/launchpad/branches-are-more-than-private
Merge into: lp:launchpad
Diff against target: 83 lines (+8/-23)
2 files modified
lib/lp/registry/browser/pillar.py (+2/-8)
lib/lp/registry/browser/tests/test_pillar_sharing.py (+6/-15)
To merge this branch: bzr merge lp:~stevenk/launchpad/branches-are-more-than-private
Reviewer Review Type Date Requested Status
Ian Booth (community) Approve
Review via email: mp+122436@code.launchpad.net

Commit message

No longer override all branches to USERDATA in PillarPersonSharingView.

Description of the change

No longer override all branches to USERDATA in PillarPersonSharingView, and add a test for that case.

I have also done some other clean-up -- we no longer need to special case creating the bug, since makeBug now just takes a target argument. We also don't need to create APAs, so I've removed that too.

To post a comment you must log in.
Revision history for this message
Ian Booth (wallyworld) wrote :

Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/pillar.py'
2--- lib/lp/registry/browser/pillar.py 2012-08-24 05:09:51 +0000
3+++ lib/lp/registry/browser/pillar.py 2012-09-03 04:29:19 +0000
4@@ -46,10 +46,7 @@
5 from lp.bugs.browser.structuralsubscription import (
6 StructuralSubscriptionMenuMixin,
7 )
8-from lp.registry.enums import (
9- EXCLUSIVE_TEAM_POLICY,
10- InformationType,
11- )
12+from lp.registry.enums import EXCLUSIVE_TEAM_POLICY
13 from lp.registry.interfaces.distributionsourcepackage import (
14 IDistributionSourcePackage,
15 )
16@@ -423,15 +420,12 @@
17 def _build_branch_template_data(self, branches, request):
18 branch_data = []
19 for branch in branches:
20- # At the moment, all branches displayed on the sharing details
21- # page are private.
22- information_type = InformationType.USERDATA.title
23 branch_data.append(dict(
24 self_link=absoluteURL(branch, request),
25 web_link=canonical_url(branch, path_only_if_possible=True),
26 branch_name=branch.unique_name,
27 branch_id=branch.id,
28- information_type=information_type))
29+ information_type=branch.information_type.title))
30 return branch_data
31
32 def _build_bug_template_data(self, bugtasks, request):
33
34=== modified file 'lib/lp/registry/browser/tests/test_pillar_sharing.py'
35--- lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-08-24 05:09:51 +0000
36+++ lib/lp/registry/browser/tests/test_pillar_sharing.py 2012-09-03 04:29:19 +0000
37@@ -86,7 +86,7 @@
38 if with_branch and self.pillar_type == 'product':
39 branch = self.factory.makeBranch(
40 product=self.pillar, owner=self.pillar.owner,
41- information_type=InformationType.USERDATA)
42+ information_type=InformationType.PRIVATESECURITY)
43 artifacts.append(
44 self.factory.makeAccessArtifact(concrete=branch))
45
46@@ -95,24 +95,15 @@
47 owner = self.factory.makePerson()
48 else:
49 owner = self.pillar.owner
50- if self.pillar_type == 'product':
51- bug = self.factory.makeBug(
52- target=self.pillar, owner=owner,
53- information_type=InformationType.USERDATA)
54- elif self.pillar_type == 'distribution':
55- bug = self.factory.makeBug(
56- target=self.pillar, owner=owner,
57- information_type=InformationType.USERDATA)
58+ bug = self.factory.makeBug(
59+ target=self.pillar, owner=owner,
60+ information_type=InformationType.USERDATA)
61 artifacts.append(
62 self.factory.makeAccessArtifact(concrete=bug))
63
64 for artifact in artifacts:
65- self.factory.makeAccessPolicyArtifact(
66- artifact=artifact, policy=self.access_policy)
67 self.factory.makeAccessArtifactGrant(
68- artifact=artifact,
69- grantee=grantee,
70- grantor=self.pillar.owner)
71+ artifact=artifact, grantee=grantee, grantor=self.pillar.owner)
72 return grantee
73
74 def setupSharing(self, grantees):
75@@ -207,7 +198,7 @@
76 self.assertEqual({
77 'branch_id': branch.id,
78 'branch_name': branch.unique_name,
79- 'information_type': InformationType.USERDATA.title,
80+ 'information_type': branch.information_type.title,
81 'web_link': canonical_url(branch, path_only_if_possible=True),
82 'self_link': absoluteURL(branch, request),
83 }, cache.objects.get('branches')[0])