launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #11357
[Merge] lp:~wallyworld/launchpad/new-project-sharing-policies-1040989 into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/new-project-sharing-policies-1040989 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1040989 in Launchpad itself: "new project have legacy sharing policies"
https://bugs.launchpad.net/launchpad/+bug/1040989
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/new-project-sharing-policies-1040989/+merge/121532
== Implementation ==
The IProductSet createProduct() API is updated to ensure projects are created with the correct default sharing policies.
Open (non-proprietary) projects get PUBLIC for bugs and branches.
Proprietary projects get PROPRIETARY for bugs and branches.
== Tests ==
Update TestProduct:
- test_open_product_creation_sharing_policies
- test_proprietary_product_creation_sharing_policies
== Lint ==
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/registry/model/product.py
lib/lp/registry/tests/test_product.py
--
https://code.launchpad.net/~wallyworld/launchpad/new-project-sharing-policies-1040989/+merge/121532
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/new-project-sharing-policies-1040989 into lp:launchpad.
=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py 2012-08-23 02:52:31 +0000
+++ lib/lp/registry/model/product.py 2012-08-28 03:52:20 +0000
@@ -1555,6 +1555,17 @@
if len(licenses) > 0:
product._setLicenses(licenses, reset_project_reviewed=False)
+ # By default, new non-proprietary projects use public bugs and
+ # branches. Proprietary projects are given a complimentary 30 day
+ # commercial subscription and so may use proprietary sharing policies.
+ bug_sharing_policy_to_use = BugSharingPolicy.PUBLIC
+ branch_sharing_policy_to_use = BranchSharingPolicy.PUBLIC
+ if product.commercial_subscription is not None:
+ bug_sharing_policy_to_use = BugSharingPolicy.PROPRIETARY
+ branch_sharing_policy_to_use = BranchSharingPolicy.PROPRIETARY
+ product.setBugSharingPolicy(bug_sharing_policy_to_use)
+ product.setBranchSharingPolicy(branch_sharing_policy_to_use)
+
# Create a default trunk series and set it as the development focus
trunk = product.newSeries(
owner, 'trunk',
=== modified file 'lib/lp/registry/tests/test_product.py'
--- lib/lp/registry/tests/test_product.py 2012-08-23 02:52:31 +0000
+++ lib/lp/registry/tests/test_product.py 2012-08-28 03:52:20 +0000
@@ -363,6 +363,31 @@
grantees = set([grant.grantee for grant in grants])
self.assertEqual(expected_grantess, grantees)
+ def test_open_product_creation_sharing_policies(self):
+ # Creating a new open (non-proprietary) product sets the bug and branch
+ # sharing polices to public.
+ owner = self.factory.makePerson()
+ with person_logged_in(owner):
+ product = getUtility(IProductSet).createProduct(
+ owner, 'carrot', 'Carrot', 'Carrot', 'testing',
+ licenses=[License.MIT])
+ self.assertEqual(BugSharingPolicy.PUBLIC, product.bug_sharing_policy)
+ self.assertEqual(
+ BranchSharingPolicy.PUBLIC, product.branch_sharing_policy)
+
+ def test_proprietary_product_creation_sharing_policies(self):
+ # Creating a new proprietary product sets the bug and branch sharing
+ # polices to proprietary.
+ owner = self.factory.makePerson()
+ with person_logged_in(owner):
+ product = getUtility(IProductSet).createProduct(
+ owner, 'carrot', 'Carrot', 'Carrot', 'testing',
+ licenses=[License.OTHER_PROPRIETARY])
+ self.assertEqual(
+ BugSharingPolicy.PROPRIETARY, product.bug_sharing_policy)
+ self.assertEqual(
+ BranchSharingPolicy.PROPRIETARY, product.branch_sharing_policy)
+
class TestProductBugInformationTypes(TestCaseWithFactory):
Follow ups