← Back to team overview

launchpad-reviewers team mailing list archive

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

 

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

Requested reviews:
  Robert Collins (lifeless): db
  Stuart Bishop (stub): db

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

= Summary =
Remove garbo job
Previous: https://code.launchpad.net/~abentley/launchpad/blueprint-info-type-code/+merge/117981

== Proposed fix ==
The garbo job's tests assume that Specification.information_type is nullable.  Before we can set it to NOT NULL, we must remove the tests, and therefore the job.

== Pre-implementation notes ==
Advised by lifeless and wgrant

== LOC Rationale ==
Part of Private Projects

== Implementation details ==
None

== Tests ==
None

== Demo and Q/A ==
None


= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  database/schema/patch-2209-28-1.sql
  database/schema/comments.sql
  database/schema/security.cfg
  lib/lp/blueprints/model/specification.py
  database/schema/patch-2209-28-2.sql
  lib/lp/blueprints/interfaces/specification.py
-- 
https://code.launchpad.net/~abentley/launchpad/blueprint-info-type-remove-garbo/+merge/117983
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py	2012-08-02 20:06:21 +0000
+++ lib/lp/scripts/garbo.py	2012-07-23 11:25:26 +0000
@@ -26,11 +26,7 @@
 import iso8601
 from psycopg2 import IntegrityError
 import pytz
-from storm.expr import (
-    In,
-    Select,
-    Update,
-    )
+from storm.expr import In
 from storm.locals import (
     Max,
     Min,
@@ -42,7 +38,6 @@
 from zope.security.proxy import removeSecurityProxy
 
 from lp.answers.model.answercontact import AnswerContact
-from lp.blueprints.model.specification import Specification
 from lp.bugs.interfaces.bug import IBugSet
 from lp.bugs.model.bug import Bug
 from lp.bugs.model.bugattachment import BugAttachment
@@ -932,32 +927,6 @@
         self.done = True
 
 
-class SpecificationInformationTypeDefault(TunableLoop):
-    """Set all Specification.information_type to Public (default)."""
-    maximum_chunk_size = 1000
-
-    def __init__(self, log, abort_time=None):
-        super(SpecificationInformationTypeDefault, self).__init__(log,
-                                                                  abort_time)
-        self.rows_updated = None
-        self.store = IMasterStore(Specification)
-
-    def isDone(self):
-        """See `TunableLoop`."""
-        return self.rows_updated == 0
-
-    def __call__(self, chunk_size):
-        """See `TunableLoop`."""
-        subselect = Select(
-            Specification.id, Specification.information_type == None,
-            limit=chunk_size)
-        result = self.store.execute(
-            Update({Specification.information_type: 1},
-                   Specification.id.is_in(subselect)))
-        transaction.commit()
-        self.rows_updated = result.rowcount
-
-
 class UnusedPOTMsgSetPruner(TunableLoop):
     """Cleans up unused POTMsgSets."""
 
@@ -1304,7 +1273,6 @@
         OldTimeLimitedTokenDeleter,
         RevisionAuthorEmailLinker,
         ScrubPOFileTranslator,
-        SpecificationInformationTypeDefault,
         SuggestiveTemplatesCacheUpdater,
         POTranslationPruner,
         UnusedPOTMsgSetPruner,

=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py	2012-08-02 20:06:21 +0000
+++ lib/lp/scripts/tests/test_garbo.py	2012-07-23 11:25:26 +0000
@@ -35,7 +35,6 @@
 from zope.security.proxy import removeSecurityProxy
 
 from lp.answers.model.answercontact import AnswerContact
-from lp.blueprints.model.specification import Specification
 from lp.bugs.model.bugnotification import (
     BugNotification,
     BugNotificationRecipient,
@@ -621,18 +620,6 @@
             "SELECT COUNT(*) FROM %s" % table_name).get_one()[0]
         self.failUnless(num_unexpired > 0)
 
-    def test_SpecificationInformationTypeDefault(self):
-        switch_dbuser('testadmin')
-        spec = self.factory.makeSpecification()
-        removeSecurityProxy(spec).information_type = None
-        store = Store.of(spec)
-        store.flush()
-        self.assertEqual(1, store.find(Specification,
-            Specification.information_type == None).count())
-        self.runDaily()
-        self.assertEqual(0, store.find(Specification,
-            Specification.information_type == None).count())
-
     def test_RevisionAuthorEmailLinker(self):
         switch_dbuser('testadmin')
         rev1 = self.factory.makeRevision('Author 1 <author-1@xxxxxxxxxxx>')


Follow ups