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

Proposed by Deryck Hodge
Status: Merged
Merged at revision: 16369
Proposed branch: lp:~deryck/launchpad/remove-product-info-typo-garbo
Merge into: lp:launchpad
Diff against target: 66 lines (+0/-45)
2 files modified
lib/lp/scripts/garbo.py (+0/-27)
lib/lp/scripts/tests/test_garbo.py (+0/-18)
To merge this branch: bzr merge lp:~deryck/launchpad/remove-product-info-typo-garbo
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+137210@code.launchpad.net

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.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Abel Deuring (adeuring) wrote :

I think you also need to remove ProductInformationTypeDefault from DailyDatabaseGarbageCollector.tunable_loops, at the bottom of lib/lp/scripts/garbo.py

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
1187 self._update_oldest()1187 self._update_oldest()
11881188
11891189
1190class ProductInformationTypeDefault(TunableLoop):
1191 """Set all Product.information_type to Public."""
1192
1193 maximum_chunk_size = 1000
1194
1195 def __init__(self, log, abort_time=None):
1196 super(ProductInformationTypeDefault, self).__init__(
1197 log, abort_time)
1198 self.rows_updated = None
1199 self.store = IMasterStore(Product)
1200
1201 def isDone(self):
1202 """See `TunableLoop`."""
1203 return self.rows_updated == 0
1204
1205 def __call__(self, chunk_size):
1206 """See `TunableLoop`."""
1207 subselect = Select(
1208 Product.id, Product._information_type == None,
1209 limit=chunk_size)
1210 result = self.store.execute(
1211 Update({Product._information_type: 1},
1212 Product.id.is_in(subselect)))
1213 transaction.commit()
1214 self.rows_updated = result.rowcount
1215
1216
1217class SuggestiveTemplatesCacheUpdater(TunableLoop):1190class SuggestiveTemplatesCacheUpdater(TunableLoop):
1218 """Refresh the SuggestivePOTemplate cache.1191 """Refresh the SuggestivePOTemplate cache.
12191192
12201193
=== 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 @@
1148 [InformationType.PRIVATESECURITY, InformationType.PROPRIETARY],1148 [InformationType.PRIVATESECURITY, InformationType.PROPRIETARY],
1149 self.getAccessPolicyTypes(product))1149 self.getAccessPolicyTypes(product))
11501150
1151 def test_ProductInformationTypeDefault(self):
1152 switch_dbuser('testadmin')
1153 # Set all existing projects to something other than None or 1.
1154 store = IMasterStore(Product)
1155 store.execute(Update(
1156 {Product._information_type: 2}))
1157 store.flush()
1158 # Make a new product without an information_type.
1159 product = self.factory.makeProduct()
1160 store.execute(Update(
1161 {Product._information_type: None}, Product.id == product.id))
1162 store.flush()
1163 self.assertEqual(1, store.find(Product,
1164 Product._information_type == None).count())
1165 self.runDaily()
1166 self.assertEqual(0, store.find(Product,
1167 Product._information_type == None).count())
1168
1169 def test_PopulateLatestPersonSourcePackageReleaseCache(self):1151 def test_PopulateLatestPersonSourcePackageReleaseCache(self):
1170 switch_dbuser('testadmin')1152 switch_dbuser('testadmin')
1171 # Make some same test data - we create published source package1153 # Make some same test data - we create published source package