← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~abentley/launchpad/product-info-type-garbo into lp:launchpad

 

Aaron Bentley has proposed merging lp:~abentley/launchpad/product-info-type-garbo into lp:launchpad with lp:~abentley/launchpad/model-product-info-type as a prerequisite.

Commit message:
Garbo job defaults Product.information_type to PUBLIC.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~abentley/launchpad/product-info-type-garbo/+merge/127579

= Summary =
Provide a garbo job that sets Product.information_type to PUBLIC (1) by default.

== Proposed fix ==
Re-purpose the now-unused SpecificationSharingPolicyDefault to set Product.information_type instead.

== Pre-implementation notes ==
discussed with deryck

== LOC Rationale ==
Part of private projects

== Implementation details ==
None

== Tests ==
bin/test -t test_ProductInformationTypeDefaul test_garbo

== Demo and Q/A ==
None

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/registry/configure.zcml
  lib/lp/registry/interfaces/product.py
  lib/lp/app/model/launchpad.py
  lib/lp/testing/factory.py
  lib/lp/scripts/garbo.py
  lib/lp/blueprints/model/specification.py
  lib/lp/scripts/tests/test_garbo.py
  lib/lp/bugs/model/bug.py
  lib/lp/registry/model/product.py
  lib/lp/registry/tests/test_product.py
-- 
https://code.launchpad.net/~abentley/launchpad/product-info-type-garbo/+merge/127579
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~abentley/launchpad/product-info-type-garbo into lp:launchpad.
=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py	2012-09-28 06:25:44 +0000
+++ lib/lp/scripts/garbo.py	2012-10-02 19:31:24 +0000
@@ -910,13 +910,13 @@
         self._update_oldest()
 
 
-class SpecificationSharingPolicyDefault(TunableLoop):
-    """Set all Product.specification_sharing_policy to Public."""
+class ProductInformationTypeDefault(TunableLoop):
+    """Set all Product.information_type to Public."""
 
     maximum_chunk_size = 1000
 
     def __init__(self, log, abort_time=None):
-        super(SpecificationSharingPolicyDefault, self).__init__(
+        super(ProductInformationTypeDefault, self).__init__(
             log, abort_time)
         self.rows_updated = None
         self.store = IMasterStore(Product)
@@ -928,10 +928,10 @@
     def __call__(self, chunk_size):
         """See `TunableLoop`."""
         subselect = Select(
-            Product.id, Product.specification_sharing_policy == None,
+            Product.id, Product.information_type == None,
             limit=chunk_size)
         result = self.store.execute(
-            Update({Product.specification_sharing_policy: 1},
+            Update({Product.information_type: 1},
             Product.id.is_in(subselect)))
         transaction.commit()
         self.rows_updated = result.rowcount
@@ -1331,7 +1331,7 @@
         OldTimeLimitedTokenDeleter,
         RevisionAuthorEmailLinker,
         ScrubPOFileTranslator,
-        SpecificationSharingPolicyDefault,
+        ProductInformationTypeDefault,
         SuggestiveTemplatesCacheUpdater,
         POTranslationPruner,
         UnlinkedAccountPruner,

=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py	2012-09-28 06:25:44 +0000
+++ lib/lp/scripts/tests/test_garbo.py	2012-10-02 19:31:24 +0000
@@ -1059,22 +1059,22 @@
             [InformationType.PRIVATESECURITY, InformationType.PROPRIETARY],
             self.getAccessPolicyTypes(product))
 
-    def test_SpecificationSharingPolicyDefault(self):
+    def test_ProductInformationTypeDefault(self):
         switch_dbuser('testadmin')
         # Set all existing projects to something other than None or 1.
         store = IMasterStore(Product)
         store.execute(Update(
-            {Product.specification_sharing_policy: 2}))
+            {Product.information_type: 2}))
         store.flush()
-        # Make a new product without a specification_sharing_policy.
+        # Make a new product without an information_type.
         product = self.factory.makeProduct()
-        removeSecurityProxy(product).specification_sharing_policy = None
+        removeSecurityProxy(product).information_type = None
         store.flush()
         self.assertEqual(1, store.find(Product,
-            Product.specification_sharing_policy == None).count())
+            Product.information_type == None).count())
         self.runDaily()
         self.assertEqual(0, store.find(Product,
-            Product.specification_sharing_policy == None).count())
+            Product.information_type == None).count())
 
 
 class TestGarboTasks(TestCaseWithFactory):


Follow ups