← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~wallyworld/launchpad/commercial-expired-job-1047026 into lp:launchpad

 

Ian Booth has proposed merging lp:~wallyworld/launchpad/commercial-expired-job-1047026 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1047026 in Launchpad itself: "Commercial subscription expiration does not reconfigure sharing polcies"
  https://bugs.launchpad.net/launchpad/+bug/1047026

For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/commercial-expired-job-1047026/+merge/124842

== Implementation ==

Update the job's _deactivateCommercialFeatures() method to set bug and branch sharing policies to PUBLIC.

Anything else need doing?

== Tests ==

Update the test_deactivateCommercialFeatures_open_source test.

== Lint ==

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/registry/model/productjob.py
  lib/lp/registry/tests/test_productjob.py

-- 
https://code.launchpad.net/~wallyworld/launchpad/commercial-expired-job-1047026/+merge/124842
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/commercial-expired-job-1047026 into lp:launchpad.
=== modified file 'lib/lp/registry/model/productjob.py'
--- lib/lp/registry/model/productjob.py	2012-06-18 20:33:55 +0000
+++ lib/lp/registry/model/productjob.py	2012-09-18 05:35:22 +0000
@@ -38,7 +38,11 @@
 from zope.security.proxy import removeSecurityProxy
 
 from lp.app.interfaces.launchpad import ILaunchpadCelebrities
-from lp.registry.enums import ProductJobType
+from lp.registry.enums import (
+    BranchSharingPolicy,
+    BugSharingPolicy,
+    ProductJobType,
+    )
 from lp.registry.interfaces.person import IPersonSet
 from lp.registry.interfaces.product import (
     IProduct,
@@ -468,7 +472,10 @@
         if self._is_proprietary:
             self.product.active = False
         else:
-            removeSecurityProxy(self.product).private_bugs = False
+            naked_product = removeSecurityProxy(self.product)
+            naked_product.private_bugs = False
+            naked_product.setBranchSharingPolicy(BranchSharingPolicy.PUBLIC)
+            naked_product.setBugSharingPolicy(BugSharingPolicy.PUBLIC)
             for series in self.product.series:
                 if series.branch is not None and series.branch.private:
                     removeSecurityProxy(series).branch = None

=== modified file 'lib/lp/registry/tests/test_productjob.py'
--- lib/lp/registry/tests/test_productjob.py	2012-08-13 19:34:10 +0000
+++ lib/lp/registry/tests/test_productjob.py	2012-09-18 05:35:22 +0000
@@ -23,6 +23,8 @@
 
 from lp.app.interfaces.launchpad import ILaunchpadCelebrities
 from lp.registry.enums import (
+    BugSharingPolicy,
+    BranchSharingPolicy,
     InformationType,
     ProductJobType,
     )
@@ -723,6 +725,10 @@
         clear_property_cache(product)
         self.assertIs(True, product.active)
         self.assertIs(False, product.private_bugs)
+        self.assertEqual(
+            BranchSharingPolicy.PUBLIC, product.branch_sharing_policy)
+        self.assertEqual(
+            BugSharingPolicy.PUBLIC, product.bug_sharing_policy)
         self.assertEqual(public_branch, public_series.branch)
         self.assertIs(None, private_series.branch)
         self.assertIs(None, product.commercial_subscription)


Follow ups