← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~deryck/launchpad/remove-product-info-typo-garbo into lp:launchpad

 

Deryck Hodge has proposed merging lp:~deryck/launchpad/remove-product-info-typo-garbo into lp:launchpad.

Commit message:
Remove the garbo job and related test to populate default values for Product.information_type, which is no longer needed due to model and db schema changes.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~deryck/launchpad/remove-product-info-typo-garbo/+merge/137210

This branch is really just a bit of clean up.  We no longer need the garbo job to populate default values for Product.information_type. This branch removes that job and its related test.

We should be safe to remove this now, since model code adds a default for us.  But just to be cautious, I won't land this until my recent db patches are deployed.
-- 
https://code.launchpad.net/~deryck/launchpad/remove-product-info-typo-garbo/+merge/137210
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~deryck/launchpad/remove-product-info-typo-garbo into lp:launchpad.
=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py	2012-11-26 08:33:03 +0000
+++ lib/lp/scripts/garbo.py	2012-11-30 14:31:56 +0000
@@ -1187,33 +1187,6 @@
         self._update_oldest()
 
 
-class ProductInformationTypeDefault(TunableLoop):
-    """Set all Product.information_type to Public."""
-
-    maximum_chunk_size = 1000
-
-    def __init__(self, log, abort_time=None):
-        super(ProductInformationTypeDefault, self).__init__(
-            log, abort_time)
-        self.rows_updated = None
-        self.store = IMasterStore(Product)
-
-    def isDone(self):
-        """See `TunableLoop`."""
-        return self.rows_updated == 0
-
-    def __call__(self, chunk_size):
-        """See `TunableLoop`."""
-        subselect = Select(
-            Product.id, Product._information_type == None,
-            limit=chunk_size)
-        result = self.store.execute(
-            Update({Product._information_type: 1},
-            Product.id.is_in(subselect)))
-        transaction.commit()
-        self.rows_updated = result.rowcount
-
-
 class SuggestiveTemplatesCacheUpdater(TunableLoop):
     """Refresh the SuggestivePOTemplate cache.
 

=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py	2012-11-26 08:33:03 +0000
+++ lib/lp/scripts/tests/test_garbo.py	2012-11-30 14:31:56 +0000
@@ -1148,24 +1148,6 @@
             [InformationType.PRIVATESECURITY, InformationType.PROPRIETARY],
             self.getAccessPolicyTypes(product))
 
-    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._information_type: 2}))
-        store.flush()
-        # Make a new product without an information_type.
-        product = self.factory.makeProduct()
-        store.execute(Update(
-            {Product._information_type: None}, Product.id == product.id))
-        store.flush()
-        self.assertEqual(1, store.find(Product,
-            Product._information_type == None).count())
-        self.runDaily()
-        self.assertEqual(0, store.find(Product,
-            Product._information_type == None).count())
-
     def test_PopulateLatestPersonSourcePackageReleaseCache(self):
         switch_dbuser('testadmin')
         # Make some same test data - we create published source package


Follow ups