← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/no-export-istoreselector into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/no-export-istoreselector into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/no-export-istoreselector/+merge/170727

Destroy most callsites of IStoreSelector, switching them to I{,Master,Slave}Store instead.
-- 
https://code.launchpad.net/~stevenk/launchpad/no-export-istoreselector/+merge/170727
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/no-export-istoreselector into lp:launchpad.
=== modified file 'cronscripts/librarian-gc.py'
--- cronscripts/librarian-gc.py	2013-01-07 02:40:55 +0000
+++ cronscripts/librarian-gc.py	2013-06-21 02:35:32 +0000
@@ -17,7 +17,7 @@
 import logging
 
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.librarian.model import LibraryFileAlias
 from lp.services.librarianserver import librariangc
 from lp.services.scripts.base import LaunchpadCronScript

=== modified file 'cronscripts/update-database-stats.py'
--- cronscripts/update-database-stats.py	2012-09-28 06:25:44 +0000
+++ cronscripts/update-database-stats.py	2013-06-21 02:35:32 +0000
@@ -8,13 +8,8 @@
 
 import _pythonpath
 
-from zope.component import getUtility
-
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    )
+from lp.registry.model.person import Person
+from lp.services.database.interfaces import IMasterStore
 from lp.services.scripts import db_options
 from lp.services.scripts.base import LaunchpadCronScript
 
@@ -24,7 +19,7 @@
 
     def main(self):
         "Run UpdateDatabaseTableStats."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        store = IMasterStore(Person)
 
         # The logic is in a stored procedure because we want to run
         # ps(1) on the database server rather than the host this script
@@ -43,4 +38,3 @@
     script = UpdateDatabaseStats(
         'update-database-stats', dbuser='database_stats_update')
     script.lock_and_run()
-

=== modified file 'lib/lp/answers/model/questionjob.py'
--- lib/lp/answers/model/questionjob.py	2012-04-26 15:07:05 +0000
+++ lib/lp/answers/model/questionjob.py	2013-06-21 02:35:32 +0000
@@ -35,7 +35,7 @@
 from lp.registry.interfaces.person import IPersonSet
 from lp.services.config import config
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.database.stormbase import StormBase
 from lp.services.job.model.job import Job
 from lp.services.job.runner import BaseRunnableJob

=== modified file 'lib/lp/answers/tests/test_questionjob.py'
--- lib/lp/answers/tests/test_questionjob.py	2012-08-08 07:22:51 +0000
+++ lib/lp/answers/tests/test_questionjob.py	2013-06-21 02:35:32 +0000
@@ -25,7 +25,7 @@
     QuestionEmailJob,
     QuestionJob,
     )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.features.testing import FeatureFixture
 from lp.services.job.interfaces.job import JobStatus
 from lp.services.job.tests import (

=== modified file 'lib/lp/app/stories/basics/xx-dbpolicy.txt'
--- lib/lp/app/stories/basics/xx-dbpolicy.txt	2013-05-02 00:40:14 +0000
+++ lib/lp/app/stories/basics/xx-dbpolicy.txt	2013-06-21 02:35:32 +0000
@@ -17,25 +17,21 @@
     ...     """)
     >>> config.push('empty_slave', config_overlay)
 
-    >>> from zope.component import getUtility
-    >>> from lp.services.database.interfaces import (
-    ...     IStoreSelector, MAIN_STORE, MASTER_FLAVOR, SLAVE_FLAVOR)
+    >>> from lp.registry.model.person import Person
+    >>> from lp.services.database.interfaces import IMasterStore, ISlaveStore
     >>> from lp.testing.layers import DatabaseLayer
-    >>> master = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+    >>> master = IMasterStore(Person)
     >>> dbname = DatabaseLayer._db_fixture.dbname
     >>> dbname == master.execute("SELECT current_database()").get_one()[0]
     True
-    >>> slave = getUtility(IStoreSelector).get(MAIN_STORE, SLAVE_FLAVOR)
+    >>> slave = ISlaveStore(Person)
     >>> slave.execute("SELECT current_database()").get_one()[0]
     u'launchpad_empty'
 
 We should confirm that the empty database is as empty as we hope it is.
 
-    >>> from lp.registry.model.person import Person
-    >>> slave_store = getUtility(IStoreSelector).get(
-    ...     MAIN_STORE, SLAVE_FLAVOR)
-    >>> master_store = getUtility(IStoreSelector).get(
-    ...     MAIN_STORE, MASTER_FLAVOR)
+    >>> slave_store = ISlaveStore(Person)
+    >>> master_store = IMasterStore(Person)
     >>> slave_store.find(Person).is_empty()
     True
     >>> master_store.find(Person).is_empty()

=== modified file 'lib/lp/app/stories/basics/xx-opstats.txt'
--- lib/lp/app/stories/basics/xx-opstats.txt	2012-09-07 06:25:10 +0000
+++ lib/lp/app/stories/basics/xx-opstats.txt	2013-06-21 02:35:32 +0000
@@ -282,7 +282,7 @@
 
 But our database connections are broken.
 
-    >>> from lp.services.database.lpstorm import IStore
+    >>> from lp.services.database.interfaces import IStore
     >>> from lp.registry.model.person import Person
     >>> IStore(Person).find(Person, name='janitor')
     Traceback (most recent call last):

=== modified file 'lib/lp/archivepublisher/domination.py'
--- lib/lp/archivepublisher/domination.py	2013-05-02 00:40:14 +0000
+++ lib/lp/archivepublisher/domination.py	2013-06-21 02:35:32 +0000
@@ -75,7 +75,7 @@
 from lp.services.database.bulk import load_related
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     flush_database_updates,
     sqlvalues,

=== modified file 'lib/lp/archivepublisher/htaccess.py'
--- lib/lp/archivepublisher/htaccess.py	2013-01-07 02:40:55 +0000
+++ lib/lp/archivepublisher/htaccess.py	2013-06-21 02:35:32 +0000
@@ -19,7 +19,7 @@
 import os
 
 from lp.registry.model.person import Person
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.soyuz.model.archiveauthtoken import ArchiveAuthToken
 
 

=== modified file 'lib/lp/archivepublisher/model/ftparchive.py'
--- lib/lp/archivepublisher/model/ftparchive.py	2013-05-16 00:08:28 +0000
+++ lib/lp/archivepublisher/model/ftparchive.py	2013-06-21 02:35:32 +0000
@@ -10,7 +10,6 @@
     Join,
     )
 from storm.store import EmptyResultSet
-from zope.component import getUtility
 
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.registry.model.sourcepackagename import SourcePackageName
@@ -19,11 +18,7 @@
     OutputLineHandler,
     ReturnCodeReceiver,
     )
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.stormexpr import Concatenate
 from lp.services.librarian.model import LibraryFileAlias
 from lp.services.osutils import write_file
@@ -264,7 +259,6 @@
 
         :return: a `ResultSet` with the source override information tuples
         """
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         origins = (
             SourcePackagePublishingHistory,
             Join(Component,
@@ -279,15 +273,14 @@
                      SourcePackageRelease.sourcepackagenameID),
             )
 
-        result_set = store.using(*origins).find(
+        return IStore(SourcePackageName).using(*origins).find(
             (SourcePackageName.name, Component.name, Section.name),
             SourcePackagePublishingHistory.archive == self.publisher.archive,
             SourcePackagePublishingHistory.distroseries == distroseries,
             SourcePackagePublishingHistory.pocket == pocket,
             SourcePackagePublishingHistory.status ==
-                PackagePublishingStatus.PUBLISHED)
-
-        return result_set.order_by(Desc(SourcePackagePublishingHistory.id))
+                PackagePublishingStatus.PUBLISHED).order_by(
+                    Desc(SourcePackagePublishingHistory.id))
 
     def getBinariesForOverrides(self, distroseries, pocket):
         """Fetch override information about all published binaries.
@@ -302,7 +295,6 @@
 
         :return: a `ResultSet` with the binary override information tuples
         """
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         origins = (
             BinaryPackagePublishingHistory,
             Join(Component,
@@ -337,7 +329,7 @@
                 BinaryPackageRelease.binpackageformat
                     != BinaryPackageFormat.DDEB)
 
-        result_set = store.using(*origins).find(
+        result_set = IStore(BinaryPackageName).using(*origins).find(
             (BinaryPackageName.name, Component.name, Section.name,
              DistroArchSeries.architecturetag,
              BinaryPackagePublishingHistory.priority,
@@ -547,7 +539,7 @@
 
         :return: a `ResultSet` with the source files information tuples.
         """
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(SourcePackagePublishingHistory)
         result_set = store.using(SourcePackageFilePublishing).find(
             (SourcePackageFilePublishing.sourcepackagename,
              SourcePackageFilePublishing.libraryfilealiasfilename,
@@ -572,8 +564,6 @@
 
         :return: a `ResultSet` with the binary files information tuples.
         """
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-
         columns = (
             SourcePackageName.name,
             LibraryFileAlias.filename,
@@ -608,7 +598,7 @@
                 BinaryPackageRelease.binpackageformat
                     != BinaryPackageFormat.DDEB)
 
-        result_set = store.find(
+        result_set = IStore(SourcePackageRelease).find(
             columns, *(join_conditions + select_conditions))
         return result_set.order_by(
             BinaryPackagePublishingHistory.id, BinaryPackageFile.id)

=== modified file 'lib/lp/archivepublisher/model/publisherconfig.py'
--- lib/lp/archivepublisher/model/publisherconfig.py	2012-01-01 02:58:52 +0000
+++ lib/lp/archivepublisher/model/publisherconfig.py	2013-06-21 02:35:32 +0000
@@ -22,7 +22,7 @@
     IPublisherConfig,
     IPublisherConfigSet,
     )
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/archivepublisher/scripts/generate_ppa_htaccess.py'
--- lib/lp/archivepublisher/scripts/generate_ppa_htaccess.py	2013-01-07 02:40:55 +0000
+++ lib/lp/archivepublisher/scripts/generate_ppa_htaccess.py	2013-06-21 02:35:32 +0000
@@ -21,7 +21,7 @@
     )
 from lp.registry.model.teammembership import TeamParticipation
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.mail.helpers import get_email_template
 from lp.services.mail.mailwrapper import MailWrapper
 from lp.services.mail.sendmail import (

=== modified file 'lib/lp/archivepublisher/tests/test_publish_ftpmaster.py'
--- lib/lp/archivepublisher/tests/test_publish_ftpmaster.py	2012-05-23 00:25:21 +0000
+++ lib/lp/archivepublisher/tests/test_publish_ftpmaster.py	2013-06-21 02:35:32 +0000
@@ -33,7 +33,7 @@
     )
 from lp.registry.interfaces.series import SeriesStatus
 from lp.services.config import config
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.log.logger import (
     BufferLogger,
     DevNullLogger,

=== modified file 'lib/lp/archivepublisher/tests/test_publisherconfig.py'
--- lib/lp/archivepublisher/tests/test_publisherconfig.py	2012-01-01 02:58:52 +0000
+++ lib/lp/archivepublisher/tests/test_publisherconfig.py	2013-06-21 02:35:32 +0000
@@ -16,7 +16,7 @@
     IPublisherConfigSet,
     )
 from lp.archivepublisher.model.publisherconfig import PublisherConfig
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.testing import (
     ANONYMOUS,
     login,

=== modified file 'lib/lp/blueprints/model/specification.py'
--- lib/lp/blueprints/model/specification.py	2013-04-03 03:10:23 +0000
+++ lib/lp/blueprints/model/specification.py	2013-06-21 02:35:32 +0000
@@ -91,7 +91,7 @@
     )
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     convert_storm_clause_to_string,
     cursor,

=== modified file 'lib/lp/blueprints/model/specificationsearch.py'
--- lib/lp/blueprints/model/specificationsearch.py	2013-01-30 05:31:20 +0000
+++ lib/lp/blueprints/model/specificationsearch.py	2013-06-21 02:35:32 +0000
@@ -45,7 +45,7 @@
 from lp.registry.model.teammembership import TeamParticipation
 from lp.services.database.bulk import load_referencing
 from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.stormexpr import (
     Array,
     ArrayAgg,

=== modified file 'lib/lp/blueprints/tests/test_specification_access_policy_triggers.py'
--- lib/lp/blueprints/tests/test_specification_access_policy_triggers.py	2013-01-15 05:24:27 +0000
+++ lib/lp/blueprints/tests/test_specification_access_policy_triggers.py	2013-06-21 02:35:32 +0000
@@ -9,7 +9,7 @@
 from lp.app.enums import InformationType
 from lp.blueprints.model.specification import Specification
 from lp.registry.interfaces.accesspolicy import IAccessPolicySource
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.testing import TestCaseWithFactory
 from lp.testing.layers import DatabaseFunctionalLayer
 

=== modified file 'lib/lp/bugs/browser/tests/test_expose.py'
--- lib/lp/bugs/browser/tests/test_expose.py	2012-08-16 05:18:54 +0000
+++ lib/lp/bugs/browser/tests/test_expose.py	2013-06-21 02:35:32 +0000
@@ -28,7 +28,7 @@
 from lp.registry.interfaces.person import PersonVisibility
 from lp.registry.interfaces.teammembership import TeamMembershipStatus
 from lp.registry.model.person import Person
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.identity.interfaces.emailaddress import EmailAddressStatus
 from lp.services.webapp.authorization import clear_cache
 from lp.services.webapp.publisher import canonical_url

=== modified file 'lib/lp/bugs/doc/bug-heat.txt'
--- lib/lp/bugs/doc/bug-heat.txt	2012-10-16 01:07:50 +0000
+++ lib/lp/bugs/doc/bug-heat.txt	2013-06-21 02:35:32 +0000
@@ -171,7 +171,7 @@
 
     >>> from lp.bugs.interfaces.bug import IBugSet
     >>> from lp.bugs.model.bug import Bug
-    >>> from lp.services.database.lpstorm import IStore
+    >>> from lp.services.database.interfaces import IStore
     >>> IStore(Bug).find(Bug).set(
     ...     heat_last_updated=datetime.now(timezone('UTC')))
 

=== modified file 'lib/lp/bugs/doc/bug-watch-activity.txt'
--- lib/lp/bugs/doc/bug-watch-activity.txt	2012-02-21 22:46:28 +0000
+++ lib/lp/bugs/doc/bug-watch-activity.txt	2013-06-21 02:35:32 +0000
@@ -7,7 +7,7 @@
 We can create a new BugWatchActivity record for a bug watch using that
 BugWatch's addActivity() method.
 
-    >>> from lp.services.database.lpstorm import IStore
+    >>> from lp.services.database.interfaces import IStore
     >>> from lp.testing.dbuser import lp_dbuser
     >>> from lp.bugs.model.bugwatch import BugWatchActivity
 

=== modified file 'lib/lp/bugs/doc/bug.txt'
--- lib/lp/bugs/doc/bug.txt	2012-12-26 01:32:19 +0000
+++ lib/lp/bugs/doc/bug.txt	2013-06-21 02:35:32 +0000
@@ -257,7 +257,7 @@
     >>> from lp.bugs.interfaces.bugtask import IBugTaskSet
     >>> from lp.bugs.interfaces.bugtasksearch import BugTaskSearchParams
     >>> from lp.bugs.model.bug import Bug
-    >>> from lp.services.database.lpstorm import IStore
+    >>> from lp.services.database.interfaces import IStore
 
     >>> all_bugs = set(IStore(Bug).find(Bug).values(Bug.id))
 

=== modified file 'lib/lp/bugs/doc/bugsummary.txt'
--- lib/lp/bugs/doc/bugsummary.txt	2012-09-17 16:13:40 +0000
+++ lib/lp/bugs/doc/bugsummary.txt	2013-06-21 02:35:32 +0000
@@ -28,7 +28,7 @@
 viewed_by and the count. viewed_by is a team reference and used to
 query private bug counts.
 
-    >>> from lp.services.database.lpstorm import IMasterStore
+    >>> from lp.services.database.interfaces import IMasterStore
     >>> from lp.bugs.interfaces.bugtask import BugTaskStatus
     >>> from lp.bugs.model.bugsummary import BugSummary
     >>> from lp.testing import login_celebrity

=== modified file 'lib/lp/bugs/doc/official-bug-tags.txt'
--- lib/lp/bugs/doc/official-bug-tags.txt	2012-09-28 06:34:26 +0000
+++ lib/lp/bugs/doc/official-bug-tags.txt	2013-06-21 02:35:32 +0000
@@ -6,10 +6,9 @@
     >>> from zope.component import getUtility
     >>> from lp.registry.interfaces.distribution import IDistributionSet
     >>> from lp.registry.interfaces.product import IProductSet
-    >>> from lp.services.database.interfaces import (
-    ...     IStoreSelector, MAIN_STORE, DEFAULT_FLAVOR)
+    >>> from lp.services.database.interfaces import IStore
     >>> from lp.bugs.model.bugtarget import OfficialBugTag
-    >>> store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+    >>> store = IStore(OfficialBugTag)
 
     >>> ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
     >>> distro_tag = OfficialBugTag()

=== modified file 'lib/lp/bugs/doc/product-update-remote-product.txt'
--- lib/lp/bugs/doc/product-update-remote-product.txt	2012-09-28 06:34:26 +0000
+++ lib/lp/bugs/doc/product-update-remote-product.txt	2013-06-21 02:35:32 +0000
@@ -7,9 +7,9 @@
 remote_product themselves, so we have a script that tries to set this
 automatically.
 
-    >>> from lp.services.database.interfaces import (
-    ...     IStoreSelector, DEFAULT_FLAVOR, MAIN_STORE)
-    >>> store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+    >>> from lp.registry.model.product import Product
+    >>> from lp.services.database.interfaces import IStore
+    >>> store = IStore(Product)
     >>> store.execute("UPDATE Product SET remote_product = 'not-None'")
     <storm...>
 

=== modified file 'lib/lp/bugs/doc/products-with-no-remote-product.txt'
--- lib/lp/bugs/doc/products-with-no-remote-product.txt	2012-09-28 06:34:26 +0000
+++ lib/lp/bugs/doc/products-with-no-remote-product.txt	2013-06-21 02:35:32 +0000
@@ -8,9 +8,9 @@
 IProductSet.getProductsWithNoneRemoteProduct() is used for this.
 
 
-    >>> from lp.services.database.interfaces import (
-    ...     IStoreSelector, DEFAULT_FLAVOR, MAIN_STORE)
-    >>> store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+    >>> from lp.registry.model.product import Product
+    >>> from lp.services.database.interfaces import IStore
+    >>> store = IStore(Product)
     >>> store.execute("UPDATE Product SET remote_product = 'not-None'")
     <storm...>
     >>> from lp.registry.interfaces.product import IProductSet

=== modified file 'lib/lp/bugs/model/apportjob.py'
--- lib/lp/bugs/model/apportjob.py	2012-09-28 06:25:44 +0000
+++ lib/lp/bugs/model/apportjob.py	2013-06-21 02:35:32 +0000
@@ -39,12 +39,7 @@
     )
 from lp.services.config import config
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.stormbase import StormBase
 from lp.services.job.model.job import (
     EnumeratedSubclass,
@@ -107,8 +102,7 @@
     @classmethod
     def get(cls, key):
         """Return the instance of this class whose key is supplied."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        instance = store.get(cls, key)
+        instance = IStore(cls).get(cls, key)
         if instance is None:
             raise SQLObjectNotFound(
                 'No occurrence of %s has key %s' % (cls.__name__, key))
@@ -155,8 +149,7 @@
     @classmethod
     def iterReady(cls):
         """Iterate through all ready ApportJobs."""
-        store = IStore(ApportJob)
-        jobs = store.find(
+        jobs = IStore(ApportJob).find(
             ApportJob,
             And(ApportJob.job_type == cls.class_job_type,
                 ApportJob.job == Job.id,
@@ -192,8 +185,7 @@
         # We also include jobs which have been completed when checking
         # for exisiting jobs, since a BLOB should only be processed
         # once.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        job_for_blob = store.find(
+        job_for_blob = IStore(ApportJob).find(
             ApportJob,
             ApportJob.blob == blob,
             ApportJob.job_type == cls.class_job_type,

=== modified file 'lib/lp/bugs/model/bug.py'
--- lib/lp/bugs/model/bug.py	2013-05-02 00:40:14 +0000
+++ lib/lp/bugs/model/bug.py	2013-06-21 02:35:32 +0000
@@ -202,7 +202,7 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,

=== modified file 'lib/lp/bugs/model/bugbranch.py'
--- lib/lp/bugs/model/bugbranch.py	2013-01-07 02:40:55 +0000
+++ lib/lp/bugs/model/bugbranch.py	2013-06-21 02:35:32 +0000
@@ -24,7 +24,7 @@
 from lp.registry.interfaces.person import validate_public_person
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.datetimecol import UtcDateTimeCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import SQLBase
 
 

=== modified file 'lib/lp/bugs/model/bugnotification.py'
--- lib/lp/bugs/model/bugnotification.py	2013-01-07 02:40:55 +0000
+++ lib/lp/bugs/model/bugnotification.py	2013-06-21 02:35:32 +0000
@@ -53,7 +53,7 @@
 from lp.services.database import bulk
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import SQLBase
 from lp.services.database.stormbase import StormBase
 from lp.services.messages.model.message import Message

=== modified file 'lib/lp/bugs/model/bugsubscriptionfilter.py'
--- lib/lp/bugs/model/bugsubscriptionfilter.py	2013-05-21 09:37:47 +0000
+++ lib/lp/bugs/model/bugsubscriptionfilter.py	2013-06-21 02:35:32 +0000
@@ -46,7 +46,7 @@
 from lp.services import searchbuilder
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.enumcol import DBEnum
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import convert_storm_clause_to_string
 from lp.services.database.stormbase import StormBase
 
@@ -243,7 +243,7 @@
         store.find(
             StructuralSubscription,
             StructuralSubscription.id.is_in(structsub_ids),
-            Not(Exists(locked_filter_expr))).remove()        
+            Not(Exists(locked_filter_expr))).remove()
 
     def isMuteAllowed(self, person):
         """See `IBugSubscriptionFilter`."""

=== modified file 'lib/lp/bugs/model/bugtarget.py'
--- lib/lp/bugs/model/bugtarget.py	2012-10-05 02:58:01 +0000
+++ lib/lp/bugs/model/bugtarget.py	2013-06-21 02:35:32 +0000
@@ -31,7 +31,7 @@
 from lp.bugs.model.bugtask import BugTaskSet
 from lp.registry.interfaces.distribution import IDistribution
 from lp.registry.interfaces.product import IProduct
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 
 
 class HasBugsBase:

=== modified file 'lib/lp/bugs/model/bugtask.py'
--- lib/lp/bugs/model/bugtask.py	2013-03-12 05:51:28 +0000
+++ lib/lp/bugs/model/bugtask.py	2013-06-21 02:35:32 +0000
@@ -131,12 +131,7 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.nl_search import nl_phrase_search
 from lp.services.database.sqlbase import (
     block_implicit_flushes,
@@ -1362,7 +1357,7 @@
     def getBugTasks(self, bug_ids):
         """See `IBugTaskSet`."""
         from lp.bugs.model.bug import Bug
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(Bug)
         origin = [BugTask, Join(Bug, BugTask.bug == Bug.id)]
         columns = (Bug, BugTask)
         result = store.using(*origin).find(columns, Bug.id.is_in(bug_ids))

=== modified file 'lib/lp/bugs/model/bugtasksearch.py'
--- lib/lp/bugs/model/bugtasksearch.py	2013-05-01 21:23:16 +0000
+++ lib/lp/bugs/model/bugtasksearch.py	2013-06-21 02:35:32 +0000
@@ -86,7 +86,7 @@
 from lp.registry.model.teammembership import TeamParticipation
 from lp.services.database.bulk import load
 from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import sqlvalues
 from lp.services.database.stormexpr import (
     ArrayAgg,

=== modified file 'lib/lp/bugs/model/bugtracker.py'
--- lib/lp/bugs/model/bugtracker.py	2013-05-02 18:55:32 +0000
+++ lib/lp/bugs/model/bugtracker.py	2013-06-21 02:35:32 +0000
@@ -77,7 +77,7 @@
     )
 from lp.registry.model.projectgroup import ProjectGroup
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     flush_database_updates,
     SQLBase,

=== modified file 'lib/lp/bugs/model/bugwatch.py'
--- lib/lp/bugs/model/bugwatch.py	2013-04-11 04:52:14 +0000
+++ lib/lp/bugs/model/bugwatch.py	2013-06-21 02:35:32 +0000
@@ -64,7 +64,7 @@
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import SQLBase
 from lp.services.database.stormbase import StormBase
 from lp.services.helpers import (

=== modified file 'lib/lp/bugs/model/structuralsubscription.py'
--- lib/lp/bugs/model/structuralsubscription.py	2013-05-21 04:45:21 +0000
+++ lib/lp/bugs/model/structuralsubscription.py	2013-06-21 02:35:32 +0000
@@ -80,7 +80,7 @@
 from lp.registry.interfaces.sourcepackage import ISourcePackage
 from lp.registry.model.teammembership import TeamParticipation
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import quote
 from lp.services.database.stormexpr import (
     ArrayAgg,

=== modified file 'lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py'
--- lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py	2013-05-21 09:37:47 +0000
+++ lib/lp/bugs/model/tests/test_bugsubscriptionfilter.py	2013-06-21 02:35:32 +0000
@@ -7,10 +7,7 @@
 
 from storm.store import Store
 from zope.security.interfaces import Unauthorized
-from zope.security.proxy import (
-    ProxyFactory,
-    removeSecurityProxy,
-    )
+from zope.security.proxy import ProxyFactory
 
 from lp.app.enums import InformationType
 from lp.bugs.enums import BugNotificationLevel
@@ -27,7 +24,7 @@
     )
 from lp.bugs.model.structuralsubscription import StructuralSubscription
 from lp.services import searchbuilder
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.testing import (
     anonymous_logged_in,
     login_person,

=== modified file 'lib/lp/bugs/model/tests/test_bugsummary.py'
--- lib/lp/bugs/model/tests/test_bugsummary.py	2012-09-17 16:13:40 +0000
+++ lib/lp/bugs/model/tests/test_bugsummary.py	2013-06-21 02:35:32 +0000
@@ -25,7 +25,7 @@
     )
 from lp.bugs.model.bugtask import BugTask
 from lp.registry.enums import SharingPermission
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.testing import TestCaseWithFactory
 from lp.testing.dbuser import switch_dbuser
 from lp.testing.layers import LaunchpadZopelessLayer

=== modified file 'lib/lp/bugs/model/tests/test_bugtasksearch.py'
--- lib/lp/bugs/model/tests/test_bugtasksearch.py	2012-09-28 21:03:04 +0000
+++ lib/lp/bugs/model/tests/test_bugtasksearch.py	2013-06-21 02:35:32 +0000
@@ -65,7 +65,7 @@
 from lp.registry.interfaces.product import IProduct
 from lp.registry.interfaces.sourcepackage import ISourcePackage
 from lp.registry.model.person import Person
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import convert_storm_clause_to_string
 from lp.services.searchbuilder import (
     all,

=== modified file 'lib/lp/bugs/scripts/bugsummaryrebuild.py'
--- lib/lp/bugs/scripts/bugsummaryrebuild.py	2012-09-19 01:19:35 +0000
+++ lib/lp/bugs/scripts/bugsummaryrebuild.py	2013-06-21 02:35:32 +0000
@@ -38,7 +38,7 @@
 from lp.registry.model.productseries import ProductSeries
 from lp.registry.model.sourcepackagename import SourcePackageName
 from lp.services.database.bulk import create
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.stormexpr import Unnest
 from lp.services.looptuner import TunableLoop
 

=== modified file 'lib/lp/bugs/scripts/bugtasktargetnamecaches.py'
--- lib/lp/bugs/scripts/bugtasktargetnamecaches.py	2012-01-01 02:58:52 +0000
+++ lib/lp/bugs/scripts/bugtasktargetnamecaches.py	2013-06-21 02:35:32 +0000
@@ -19,7 +19,7 @@
 from lp.registry.model.product import Product
 from lp.registry.model.productseries import ProductSeries
 from lp.registry.model.sourcepackagename import SourcePackageName
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     ISlaveStore,
     )

=== modified file 'lib/lp/bugs/scripts/bzremotecomponentfinder.py'
--- lib/lp/bugs/scripts/bzremotecomponentfinder.py	2012-06-29 08:40:05 +0000
+++ lib/lp/bugs/scripts/bzremotecomponentfinder.py	2013-06-21 02:35:32 +0000
@@ -25,7 +25,7 @@
     )
 from lp.bugs.model.bugtracker import BugTrackerComponent
 from lp.services.database import bulk
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.scripts.logger import log as default_log
 
 

=== modified file 'lib/lp/bugs/scripts/checkwatches/scheduler.py'
--- lib/lp/bugs/scripts/checkwatches/scheduler.py	2011-12-30 06:14:56 +0000
+++ lib/lp/bugs/scripts/checkwatches/scheduler.py	2013-06-21 02:35:32 +0000
@@ -12,7 +12,7 @@
 
 from lp.bugs.interfaces.bugwatch import BUG_WATCH_ACTIVITY_SUCCESS_STATUSES
 from lp.bugs.model.bugwatch import BugWatch
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.database.sqlbase import sqlvalues
 from lp.services.looptuner import TunableLoop
 

=== modified file 'lib/lp/bugs/scripts/tests/test_bugnotification.py'
--- lib/lp/bugs/scripts/tests/test_bugnotification.py	2012-10-15 20:21:09 +0000
+++ lib/lp/bugs/scripts/tests/test_bugnotification.py	2013-06-21 02:35:32 +0000
@@ -67,7 +67,7 @@
 from lp.registry.interfaces.person import IPersonSet
 from lp.registry.interfaces.product import IProductSet
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     flush_database_updates,
     sqlvalues,

=== modified file 'lib/lp/bugs/scripts/tests/test_bugsummaryrebuild.py'
--- lib/lp/bugs/scripts/tests/test_bugsummaryrebuild.py	2012-09-18 18:36:09 +0000
+++ lib/lp/bugs/scripts/tests/test_bugsummaryrebuild.py	2013-06-21 02:35:32 +0000
@@ -27,7 +27,7 @@
     rebuild_bugsummary_for_target,
     )
 from lp.registry.interfaces.accesspolicy import IAccessPolicySource
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.log.logger import BufferLogger
 from lp.testing import TestCaseWithFactory
 from lp.testing.dbuser import dbuser

=== modified file 'lib/lp/bugs/stories/bugs/xx-bugs.txt'
--- lib/lp/bugs/stories/bugs/xx-bugs.txt	2012-09-28 06:34:26 +0000
+++ lib/lp/bugs/stories/bugs/xx-bugs.txt	2013-06-21 02:35:32 +0000
@@ -19,12 +19,9 @@
 In this case, let's add a simple comment to bug #2 as user Foo
 Bar. First, let's clear out the notification table:
 
-  >>> from zope.component import getUtility
   >>> from lp.bugs.model.bugnotification import BugNotification
-  >>> from lp.services.database.interfaces import (
-  ...     IStoreSelector, MAIN_STORE, DEFAULT_FLAVOR)
-
-  >>> store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+  >>> from lp.services.database.interfaces import IStore
+  >>> store = IStore(BugNotification)
   >>> store.execute("DELETE FROM BugNotification", noresult=True)
 
   >>> user_browser.open(

=== modified file 'lib/lp/bugs/tests/test_bugtaskflat_triggers.py'
--- lib/lp/bugs/tests/test_bugtaskflat_triggers.py	2012-09-18 18:36:09 +0000
+++ lib/lp/bugs/tests/test_bugtaskflat_triggers.py	2013-06-21 02:35:32 +0000
@@ -19,7 +19,7 @@
     IAccessPolicyArtifactSource,
     IAccessPolicySource,
     )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.testing import (
     login_person,
     person_logged_in,

=== modified file 'lib/lp/bugs/vocabularies.py'
--- lib/lp/bugs/vocabularies.py	2012-12-12 07:30:38 +0000
+++ lib/lp/bugs/vocabularies.py	2013-06-21 02:35:32 +0000
@@ -65,7 +65,7 @@
 from lp.registry.model.distroseries import DistroSeries
 from lp.registry.model.productseries import ProductSeries
 from lp.registry.vocabularies import DistributionVocabulary
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.helpers import (
     ensure_unicode,
     shortlist,

=== modified file 'lib/lp/buildmaster/doc/buildfarmjobbehavior.txt'
--- lib/lp/buildmaster/doc/buildfarmjobbehavior.txt	2013-04-11 05:53:01 +0000
+++ lib/lp/buildmaster/doc/buildfarmjobbehavior.txt	2013-06-21 02:35:32 +0000
@@ -65,10 +65,8 @@
 specific information.
 
     >>> from lp.buildmaster.model.builder import Builder
-    >>> from lp.services.database.interfaces import (
-    ...     IStoreSelector, MAIN_STORE, DEFAULT_FLAVOR)
-    >>> store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-    >>> bob = store.find(Builder, Builder.name == 'bob').one()
+    >>> from lp.services.database.interfaces import IStore
+    >>> bob = IStore(Builder).find(Builder, Builder.name == 'bob').one()
 
 Once the builder has the relevant behavior, it is able to provide both general
 builder functionality of its own accord, while delegating any build-type

=== modified file 'lib/lp/buildmaster/model/builder.py'
--- lib/lp/buildmaster/model/builder.py	2013-01-07 02:40:55 +0000
+++ lib/lp/buildmaster/model/builder.py	2013-06-21 02:35:32 +0000
@@ -62,10 +62,8 @@
 from lp.registry.interfaces.person import validate_public_person
 from lp.services.config import config
 from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    SLAVE_FLAVOR,
+    ISlaveStore,
+    IStore,
     )
 from lp.services.database.sqlbase import (
     SQLBase,
@@ -778,7 +776,7 @@
             extra_queries.append(qualify_subquery(job_type, query))
         query = ' AND '.join([general_query] + extra_queries) + order_clause
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(self.__class__)
         candidate_jobs = store.execute(query).get_all()
 
         for (candidate_id,) in candidate_jobs:
@@ -842,8 +840,7 @@
         """See `IBuilder`."""
         # Return a single BuildQueue for the builder provided it's
         # currently running a job.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(
+        return IStore(BuildQueue).find(
             BuildQueue,
             BuildQueue.job == Job.id,
             BuildQueue.builder == self.id,
@@ -898,8 +895,7 @@
 
     def getBuildQueueSizes(self):
         """See `IBuilderSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, SLAVE_FLAVOR)
-        results = store.find((
+        results = ISlaveStore(BuildQueue).find((
             Count(),
             Sum(BuildQueue.estimated_duration),
             Processor,

=== modified file 'lib/lp/buildmaster/model/buildfarmjob.py'
--- lib/lp/buildmaster/model/buildfarmjob.py	2013-02-06 10:40:16 +0000
+++ lib/lp/buildmaster/model/buildfarmjob.py	2013-06-21 02:35:32 +0000
@@ -43,7 +43,7 @@
     )
 from lp.buildmaster.interfaces.buildqueue import IBuildQueueSet
 from lp.services.database.enumcol import DBEnum
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/buildmaster/model/buildqueue.py'
--- lib/lp/buildmaster/model/buildqueue.py	2013-01-07 02:40:55 +0000
+++ lib/lp/buildmaster/model/buildqueue.py	2013-06-21 02:35:32 +0000
@@ -27,10 +27,7 @@
     SQLObjectNotFound,
     StringCol,
     )
-from zope.component import (
-    getSiteManager,
-    getUtility,
-    )
+from zope.component import getSiteManager
 from zope.interface import implements
 
 from lp.app.errors import NotFoundError
@@ -46,11 +43,7 @@
 from lp.services.database.bulk import load_related
 from lp.services.database.constants import DEFAULT
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,
@@ -87,13 +80,12 @@
 
 def get_builder_data():
     """How many working builders are there, how are they configured?"""
-    store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
     builder_data = """
         SELECT processor, virtualized, COUNT(id) FROM builder
         WHERE builderok = TRUE AND manual = FALSE
         GROUP BY processor, virtualized;
     """
-    results = store.execute(builder_data).get_all()
+    results = IStore(BuildQueue).execute(builder_data).get_all()
     builders_in_total = virtualized_total = 0
 
     builder_stats = defaultdict(int)
@@ -262,8 +254,7 @@
             query += """
                 AND processor = %s
             """ % sqlvalues(processor)
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result_set = store.execute(query)
+        result_set = IStore(BuildQueue).execute(query)
         free_builders = result_set.get_one()[0]
         return free_builders
 
@@ -334,8 +325,7 @@
                 AND Builder.processor = %s
                 """ % sqlvalues(head_job_processor)
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result_set = store.execute(delay_query)
+        result_set = IStore(BuildQueue).execute(delay_query)
         head_job_delay = result_set.get_one()[0]
         return (0 if head_job_delay is None else int(head_job_delay))
 
@@ -384,7 +374,6 @@
         :return: A (processor, virtualized) tuple which is the head job's
         platform or None if the JOI is the head job.
         """
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         my_platform = (
             getattr(self.processor, 'id', None),
             normalize_virtualization(self.virtualized))
@@ -400,7 +389,7 @@
         query += """
             ORDER BY lastscore DESC, job LIMIT 1
             """
-        result = store.execute(query).get_one()
+        result = IStore(BuildQueue).execute(query).get_one()
         return (my_platform if result is None else result)
 
     def _estimateJobDelay(self, builder_stats):
@@ -433,7 +422,6 @@
                 # virtualization settings.
                 return a == b
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         my_platform = (
             getattr(self.processor, 'id', None),
             normalize_virtualization(self.virtualized))
@@ -454,7 +442,7 @@
             GROUP BY BuildQueue.processor, BuildQueue.virtualized
             """
 
-        delays_by_platform = store.execute(query).get_all()
+        delays_by_platform = IStore(BuildQueue).execute(query).get_all()
 
         # This will be used to capture per-platform delay totals.
         delays = defaultdict(int)
@@ -566,8 +554,7 @@
 
     def getByJob(self, job):
         """See `IBuildQueueSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(BuildQueue, BuildQueue.job == job).one()
+        return IStore(BuildQueue).find(BuildQueue, BuildQueue.job == job).one()
 
     def count(self):
         """See `IBuildQueueSet`."""
@@ -579,8 +566,7 @@
 
     def getActiveBuildJobs(self):
         """See `IBuildQueueSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result_set = store.find(
+        return IStore(BuildQueue).find(
             BuildQueue,
             BuildQueue.job == Job.id,
             # XXX Michael Nelson 2010-02-22 bug=499421
@@ -589,4 +575,3 @@
             # status is a property. Let's use _status.
             Job._status == JobStatus.RUNNING,
             Job.date_started != None)
-        return result_set

=== modified file 'lib/lp/buildmaster/tests/test_builder.py'
--- lib/lp/buildmaster/tests/test_builder.py	2013-01-22 02:06:59 +0000
+++ lib/lp/buildmaster/tests/test_builder.py	2013-06-21 02:35:32 +0000
@@ -61,11 +61,7 @@
     WaitingSlave,
     )
 from lp.services.config import config
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import flush_database_updates
 from lp.services.job.interfaces.job import JobStatus
 from lp.services.log.logger import BufferLogger
@@ -804,8 +800,7 @@
 
     def clearBuildQueue(self):
         """Delete all `BuildQueue`, XXXJOb and `Job` instances."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        for bq in store.find(BuildQueue):
+        for bq in IStore(BuildQueue).find(BuildQueue):
             bq.destroySelf()
 
     def setUp(self):

=== modified file 'lib/lp/buildmaster/tests/test_buildqueue.py'
--- lib/lp/buildmaster/tests/test_buildqueue.py	2013-01-30 08:02:59 +0000
+++ lib/lp/buildmaster/tests/test_buildqueue.py	2013-06-21 02:35:32 +0000
@@ -31,11 +31,7 @@
     BuildQueue,
     get_builder_data,
     )
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.job.model.job import Job
 from lp.soyuz.enums import (
     ArchivePurpose,
@@ -366,11 +362,10 @@
         # p=processor, v=virtualized, e=estimated_duration, s=score
 
         # First mark all builds in the sample data as already built.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        sample_data = store.find(BinaryPackageBuild)
+        sample_data = IStore(BinaryPackageBuild).find(BinaryPackageBuild)
         for build in sample_data:
             build.buildstate = BuildStatus.FULLYBUILT
-        store.flush()
+        IStore(BinaryPackageBuild).flush()
 
         # We test builds that target a primary archive.
         self.non_ppa = self.factory.makeArchive(
@@ -706,11 +701,10 @@
         # p=processor, v=virtualized, e=estimated_duration, s=score
 
         # First mark all builds in the sample data as already built.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        sample_data = store.find(BinaryPackageBuild)
+        sample_data = IStore(BinaryPackageBuild).find(BinaryPackageBuild)
         for build in sample_data:
             build.buildstate = BuildStatus.FULLYBUILT
-        store.flush()
+        IStore(BinaryPackageBuild).flush()
 
         # We test builds that target a primary archive.
         self.non_ppa = self.factory.makeArchive(
@@ -913,11 +907,10 @@
         self.publisher.prepareBreezyAutotest()
 
         # First mark all builds in the sample data as already built.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        sample_data = store.find(BinaryPackageBuild)
+        sample_data = IStore(BinaryPackageBuild).find(BinaryPackageBuild)
         for build in sample_data:
             build.buildstate = BuildStatus.FULLYBUILT
-        store.flush()
+        IStore(BinaryPackageBuild).flush()
 
         # We test builds that target a primary archive.
         self.non_ppa = self.factory.makeArchive(
@@ -999,11 +992,10 @@
         self.publisher.prepareBreezyAutotest()
 
         # First mark all builds in the sample data as already built.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        sample_data = store.find(BinaryPackageBuild)
+        sample_data = IStore(BinaryPackageBuild).find(BinaryPackageBuild)
         for build in sample_data:
             build.buildstate = BuildStatus.FULLYBUILT
-        store.flush()
+        IStore(BinaryPackageBuild).flush()
 
         # We test builds that target a primary archive.
         self.non_ppa = self.factory.makeArchive(

=== modified file 'lib/lp/code/doc/branch.txt'
--- lib/lp/code/doc/branch.txt	2012-12-26 01:32:19 +0000
+++ lib/lp/code/doc/branch.txt	2013-06-21 02:35:32 +0000
@@ -172,10 +172,8 @@
 up our tests, so we clear the last_scanned data in all existing
 branches.
 
-    >>> from lp.services.database.interfaces import (
-    ...     IStoreSelector, MAIN_STORE, DEFAULT_FLAVOR)
-    >>> store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-    >>> store.find(Branch).set(last_scanned=None)
+    >>> from lp.services.database.interfaces import IStore
+    >>> IStore(Branch).find(Branch).set(last_scanned=None)
 
     >>> list(branchset.getRecentlyChangedBranches(5))
     []

=== modified file 'lib/lp/code/doc/revision.txt'
--- lib/lp/code/doc/revision.txt	2012-12-26 01:32:19 +0000
+++ lib/lp/code/doc/revision.txt	2013-06-21 02:35:32 +0000
@@ -6,7 +6,7 @@
 
 == Interfaces ==
 
-    >>> from lp.services.database.lpstorm import IStore
+    >>> from lp.services.database.interfaces import IStore
     >>> from lp.testing import verifyObject
     >>> from lp.code.interfaces.revision import (
     ...     IRevision, IRevisionAuthor, IRevisionParent, IRevisionSet)

=== modified file 'lib/lp/code/mail/tests/test_branchmergeproposal.py'
--- lib/lp/code/mail/tests/test_branchmergeproposal.py	2013-05-08 00:56:03 +0000
+++ lib/lp/code/mail/tests/test_branchmergeproposal.py	2013-06-21 02:35:32 +0000
@@ -31,7 +31,7 @@
 from lp.code.model.codereviewvote import CodeReviewVoteReference
 from lp.code.model.diff import PreviewDiff
 from lp.code.subscribers.branchmergeproposal import merge_proposal_modified
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.webapp import canonical_url
 from lp.testing import (
     person_logged_in,

=== modified file 'lib/lp/code/model/branch.py'
--- lib/lp/code/model/branch.py	2013-05-02 00:40:14 +0000
+++ lib/lp/code/model/branch.py	2013-06-21 02:35:32 +0000
@@ -169,7 +169,7 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,

=== modified file 'lib/lp/code/model/branchcloud.py'
--- lib/lp/code/model/branchcloud.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/model/branchcloud.py	2013-06-21 02:35:32 +0000
@@ -30,7 +30,7 @@
 from lp.code.interfaces.branch import IBranchCloud
 from lp.code.model.revision import RevisionCache
 from lp.registry.model.product import Product
-from lp.services.database.lpstorm import ISlaveStore
+from lp.services.database.interfaces import ISlaveStore
 
 
 class BranchCloud:

=== modified file 'lib/lp/code/model/branchcollection.py'
--- lib/lp/code/model/branchcollection.py	2013-03-15 01:27:19 +0000
+++ lib/lp/code/model/branchcollection.py	2013-06-21 02:35:32 +0000
@@ -72,12 +72,7 @@
     load_related,
     )
 from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import quote
 from lp.services.propertycache import get_property_cache
 from lp.services.searchbuilder import any
@@ -146,12 +141,12 @@
     @property
     def store(self):
         # Although you might think we could set the default value for store in
-        # the constructor, we can't. The IStoreSelector utility is not
+        # the constructor, we can't. The IStore utility is not
         # available at the time that the branchcollection.zcml is parsed,
         # which means we get an error if this code is in the constructor.
         # -- JonathanLange 2009-02-17.
         if self._store is None:
-            return getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+            return IStore(BugTask)
         else:
             return self._store
 

=== modified file 'lib/lp/code/model/branchjob.py'
--- lib/lp/code/model/branchjob.py	2013-05-15 04:41:33 +0000
+++ lib/lp/code/model/branchjob.py	2013-06-21 02:35:32 +0000
@@ -99,16 +99,14 @@
 from lp.services.config import config
 from lp.services.database.enumcol import EnumCol
 from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
+    IMasterStore,
+    IStore,
     )
 from lp.services.database.locking import (
     AdvisoryLockHeld,
     LockType,
     try_advisory_lock,
     )
-from lp.services.database.lpstorm import IStore
 from lp.services.database.sqlbase import SQLBase
 from lp.services.job.interfaces.job import JobStatus
 from lp.services.job.model.job import (
@@ -264,8 +262,7 @@
     @classmethod
     def iterReady(cls):
         """See `IRevisionMailJobSource`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
-        jobs = store.find(
+        jobs = IMasterStore(Branch).find(
             (BranchJob),
             And(BranchJob.job_type == cls.class_job_type,
                 BranchJob.job == Job.id,
@@ -957,8 +954,7 @@
     @staticmethod
     def iterReady():
         """See `IRosettaUploadJobSource`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
-        jobs = store.using(BranchJob, Job, Branch).find(
+        jobs = IMasterStore(BranchJob).using(BranchJob, Job, Branch).find(
             (BranchJob),
             And(BranchJob.job_type == BranchJobType.ROSETTA_UPLOAD,
                 BranchJob.job == Job.id,
@@ -970,7 +966,7 @@
     @staticmethod
     def findUnfinishedJobs(branch, since=None):
         """See `IRosettaUploadJobSource`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        store = IMasterStore(BranchJob)
         match = And(
             Job.id == BranchJob.jobID,
             BranchJob.branch == branch,

=== modified file 'lib/lp/code/model/branchlistingqueryoptimiser.py'
--- lib/lp/code/model/branchlistingqueryoptimiser.py	2012-09-28 06:25:44 +0000
+++ lib/lp/code/model/branchlistingqueryoptimiser.py	2013-06-21 02:35:32 +0000
@@ -9,7 +9,6 @@
     ]
 
 
-from zope.component import getUtility
 from zope.interface import implements
 
 from lp.code.interfaces.branch import IBranchListingQueryOptimiser
@@ -19,11 +18,7 @@
 from lp.registry.model.product import Product
 from lp.registry.model.productseries import ProductSeries
 from lp.registry.model.sourcepackagename import SourcePackageName
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 
 
 class BranchListingQueryOptimiser:
@@ -40,9 +35,8 @@
         # extra queries here by loading both the product and product series
         # objects.  These objects are then in the object cache, and not
         # queried again, but we only return the product series objects.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         return [
-            series for product, series in store.find(
+            series for product, series in IStore(Product).find(
                 (Product, ProductSeries),
                 ProductSeries.branchID.is_in(branch_ids),
                 ProductSeries.product == Product.id).order_by(
@@ -55,12 +49,11 @@
         # traverse through the distro_series, distribution and
         # sourcepackagename objects.  For this reason, we get them all in the
         # one query, and only return the SeriesSourcePackageBranch objects.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         realise_objects = (
             Distribution, DistroSeries, SourcePackageName,
             SeriesSourcePackageBranch)
         return [
-            link for distro, ds, spn, link in store.find(
+            link for distro, ds, spn, link in IStore(Product).find(
                 realise_objects,
                 SeriesSourcePackageBranch.branchID.is_in(branch_ids),
                 SeriesSourcePackageBranch.sourcepackagename ==

=== modified file 'lib/lp/code/model/branchlookup.py'
--- lib/lp/code/model/branchlookup.py	2012-11-09 23:38:28 +0000
+++ lib/lp/code/model/branchlookup.py	2013-06-21 02:35:32 +0000
@@ -68,12 +68,7 @@
 from lp.registry.model.product import Product
 from lp.registry.model.sourcepackagename import SourcePackageName
 from lp.services.config import config
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.webapp.authorization import check_permission
 
 
@@ -281,8 +276,7 @@
                     InvalidNamespace):
                 pass
         elif lookup['type'] == 'branch_name':
-            store = IStore(Branch)
-            result = store.find(Branch,
+            result = IStore(Branch).find(Branch,
                                 Branch.unique_name == lookup['unique_name'])
             for branch in result:
                 return (branch, escape(lookup['trailing']))
@@ -332,31 +326,23 @@
 
     def _getPersonalBranch(self, person, branch_name):
         """Find a personal branch given its path segments."""
-        # Avoid circular imports.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         origin = [Branch, Join(Person, Branch.owner == Person.id)]
-        result = store.using(*origin).find(
+        return IStore(Branch).using(*origin).find(
             Branch, Person.name == person,
             Branch.distroseries == None,
             Branch.product == None,
             Branch.sourcepackagename == None,
-            Branch.name == branch_name)
-        branch = result.one()
-        return branch
+            Branch.name == branch_name).one()
 
     def _getProductBranch(self, person, product, branch_name):
         """Find a product branch given its path segments."""
-        # Avoid circular imports.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         origin = [
             Branch,
             Join(Person, Branch.owner == Person.id),
             Join(Product, Branch.product == Product.id)]
-        result = store.using(*origin).find(
+        return IStore(Branch).using(*origin).find(
             Branch, Person.name == person, Product.name == product,
-            Branch.name == branch_name)
-        branch = result.one()
-        return branch
+            Branch.name == branch_name).one()
 
     def _getPackageBranch(self, owner, distribution, distroseries,
                           sourcepackagename, branch):
@@ -365,14 +351,12 @@
         Only gets unofficial source package branches, that is, branches with
         names like ~jml/ubuntu/jaunty/openssh/stuff.
         """
-        # Avoid circular imports.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         origin = [
             Branch,
             Join(Person, Branch.owner == Person.id),
             Join(SourcePackageName,
                  Branch.sourcepackagename == SourcePackageName.id)]
-        result = store.using(*origin).find(
+        return IStore(Branch).using(*origin).find(
             Branch, Person.name == owner,
             Branch.distroseriesID == Select(
                 DistroSeries.id, And(
@@ -380,9 +364,7 @@
                     DistroSeries.name == distroseries,
                     Distribution.name == distribution)),
             SourcePackageName.name == sourcepackagename,
-            Branch.name == branch)
-        branch = result.one()
-        return branch
+            Branch.name == branch).one()
 
     def getByLPPath(self, path):
         """See `IBranchLookup`."""

=== modified file 'lib/lp/code/model/branchmergeproposal.py'
--- lib/lp/code/model/branchmergeproposal.py	2013-05-14 14:30:09 +0000
+++ lib/lp/code/model/branchmergeproposal.py	2013-06-21 02:35:32 +0000
@@ -89,7 +89,7 @@
     )
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/code/model/branchmergeproposaljob.py'
--- lib/lp/code/model/branchmergeproposaljob.py	2013-04-29 21:35:48 +0000
+++ lib/lp/code/model/branchmergeproposaljob.py	2013-06-21 02:35:32 +0000
@@ -87,10 +87,8 @@
 from lp.services.config import config
 from lp.services.database.enumcol import EnumCol
 from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
+    IMasterStore,
+    IStore,
     )
 from lp.services.database.stormbase import StormBase
 from lp.services.job.interfaces.job import JobStatus
@@ -206,8 +204,7 @@
         BranchMergeProposalJob whose property "foo" is equal to "bar"'.
         """
         assert len(kwargs) > 0
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(klass, **kwargs)
+        return IStore(klass).find(klass, **kwargs)
 
     @classmethod
     def get(klass, key):
@@ -215,8 +212,7 @@
 
         :raises: SQLObjectNotFound
         """
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        instance = store.get(klass, key)
+        instance = IStore(klass).get(klass, key)
         if instance is None:
             raise SQLObjectNotFound(
                 'No occurrence of %s has key %s' % (klass.__name__, key))
@@ -277,8 +273,7 @@
     def iterReady(klass):
         """Iterate through all ready BranchMergeProposalJobs."""
         from lp.code.model.branch import Branch
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
-        jobs = store.find(
+        jobs = IMasterStore(Branch).find(
             (BranchMergeProposalJob),
             And(BranchMergeProposalJob.job_type == klass.class_job_type,
                 BranchMergeProposalJob.job == Job.id,
@@ -665,7 +660,6 @@
     @staticmethod
     def iterReady(job_type=None):
         from lp.code.model.branch import Branch
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
         SourceBranch = ClassAlias(Branch)
         TargetBranch = ClassAlias(Branch)
         clauses = [
@@ -678,7 +672,7 @@
             ]
         if job_type is not None:
             clauses.append(BranchMergeProposalJob.job_type == job_type)
-        jobs = store.find(
+        jobs = IMasterStore(Branch).find(
             (BranchMergeProposalJob, Job, BranchMergeProposal,
              SourceBranch, TargetBranch), And(*clauses))
         # Order by the job status first (to get running before waiting), then

=== modified file 'lib/lp/code/model/branchmergequeue.py'
--- lib/lp/code/model/branchmergequeue.py	2011-12-30 06:14:56 +0000
+++ lib/lp/code/model/branchmergequeue.py	2013-06-21 02:35:32 +0000
@@ -26,7 +26,7 @@
     )
 from lp.code.model.branch import Branch
 from lp.services.database.datetimecol import UtcDateTimeCol
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 
 
 class BranchMergeQueue(Storm):

=== modified file 'lib/lp/code/model/branchmergequeuecollection.py'
--- lib/lp/code/model/branchmergequeuecollection.py	2012-04-16 23:02:44 +0000
+++ lib/lp/code/model/branchmergequeuecollection.py	2013-06-21 02:35:32 +0000
@@ -19,7 +19,7 @@
     )
 from lp.code.interfaces.codehosting import LAUNCHPAD_SERVICES
 from lp.code.model.branchmergequeue import BranchMergeQueue
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 
 
 class GenericBranchMergeQueueCollection:

=== modified file 'lib/lp/code/model/branchnamespace.py'
--- lib/lp/code/model/branchnamespace.py	2012-12-11 16:36:21 +0000
+++ lib/lp/code/model/branchnamespace.py	2013-06-21 02:35:32 +0000
@@ -78,11 +78,7 @@
 from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
 from lp.registry.model.sourcepackage import SourcePackage
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 
 
 BRANCH_POLICY_ALLOWED_TYPES = {
@@ -251,8 +247,7 @@
 
     def getBranches(self, eager_load=False):
         """See `IBranchNamespace`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(Branch, self._getBranchesClause())
+        return IStore(Branch).find(Branch, self._getBranchesClause())
 
     def getBranchName(self, branch_name):
         """See `IBranchNamespace`."""
@@ -260,8 +255,7 @@
 
     def getByName(self, branch_name, default=None):
         """See `IBranchNamespace`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        match = store.find(
+        match = IStore(Branch).find(
             Branch, self._getBranchesClause(),
             Branch.name == branch_name).one()
         if match is None:

=== modified file 'lib/lp/code/model/branchpuller.py'
--- lib/lp/code/model/branchpuller.py	2012-09-28 06:25:44 +0000
+++ lib/lp/code/model/branchpuller.py	2013-06-21 02:35:32 +0000
@@ -9,18 +9,13 @@
 
 from datetime import timedelta
 
-from zope.component import getUtility
 from zope.interface import implements
 
 from lp.code.enums import BranchType
 from lp.code.interfaces.branchpuller import IBranchPuller
 from lp.code.model.branch import Branch
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 
 
 class BranchPuller:
@@ -35,8 +30,7 @@
         """See `IBranchPuller`."""
         if not branch_types:
             branch_types = (BranchType.MIRRORED, BranchType.IMPORTED)
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        branch = store.find(
+        branch = IStore(Branch).find(
             Branch,
             Branch.next_mirror_time <= UTC_NOW,
             Branch.branch_type.is_in(branch_types)).order_by(

=== modified file 'lib/lp/code/model/codeimport.py'
--- lib/lp/code/model/codeimport.py	2012-11-07 05:06:18 +0000
+++ lib/lp/code/model/codeimport.py	2013-06-21 02:35:32 +0000
@@ -60,7 +60,7 @@
 from lp.services.database.constants import DEFAULT
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import SQLBase
 
 

=== modified file 'lib/lp/code/model/codeimportjob.py'
--- lib/lp/code/model/codeimportjob.py	2012-09-28 06:25:44 +0000
+++ lib/lp/code/model/codeimportjob.py	2013-06-21 02:35:32 +0000
@@ -43,11 +43,7 @@
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,
@@ -145,8 +141,7 @@
 
     def getReclaimableJobs(self):
         """See `ICodeImportJobSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(
+        return IStore(CodeImportJob).find(
             CodeImportJob,
             "state = %s and heartbeat < %s + '-%s seconds'"
             % sqlvalues(CodeImportJobState.RUNNING, UTC_NOW,

=== modified file 'lib/lp/code/model/directbranchcommit.py'
--- lib/lp/code/model/directbranchcommit.py	2012-01-01 02:58:52 +0000
+++ lib/lp/code/model/directbranchcommit.py	2013-06-21 02:35:32 +0000
@@ -25,7 +25,7 @@
     get_stacked_on_url,
     )
 from lp.services.config import config
-from lp.services.database.lpstorm import IMasterObject
+from lp.services.database.interfaces import IMasterObject
 from lp.services.mail.sendmail import format_address_for_person
 from lp.services.osutils import override_environ
 

=== modified file 'lib/lp/code/model/revision.py'
--- lib/lp/code/model/revision.py	2013-01-07 02:40:55 +0000
+++ lib/lp/code/model/revision.py	2013-06-21 02:35:32 +0000
@@ -63,7 +63,7 @@
     UTC_NOW,
     )
 from lp.services.database.datetimecol import UtcDateTimeCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/code/model/revisioncache.py'
--- lib/lp/code/model/revisioncache.py	2012-09-28 06:25:44 +0000
+++ lib/lp/code/model/revisioncache.py	2013-06-21 02:35:32 +0000
@@ -19,7 +19,6 @@
     Func,
     SQL,
     )
-from zope.component import getUtility
 from zope.interface import implements
 
 from lp.code.interfaces.revisioncache import IRevisionCollection
@@ -31,11 +30,7 @@
 from lp.registry.model.distroseries import DistroSeries
 from lp.registry.model.product import Product
 from lp.registry.model.teammembership import TeamParticipation
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 
 
 class GenericRevisionCollection:
@@ -54,11 +49,11 @@
     @property
     def store(self):
         # Although you might think we could set the default value for store in
-        # the constructor, we can't. The IStoreSelector utility is not
+        # the constructor, we can't. The IStore utility is not
         # available at the time that the branchcollection.zcml is parsed,
         # which means we get an error if this code is in the constructor.
         if self._store is None:
-            return getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+            return IStore(Product)
         else:
             return self._store
 

=== modified file 'lib/lp/code/model/seriessourcepackagebranch.py'
--- lib/lp/code/model/seriessourcepackagebranch.py	2013-01-07 02:40:55 +0000
+++ lib/lp/code/model/seriessourcepackagebranch.py	2013-06-21 02:35:32 +0000
@@ -18,7 +18,6 @@
     Reference,
     Storm,
     )
-from zope.component import getUtility
 from zope.interface import implements
 
 from lp.code.interfaces.seriessourcepackagebranch import (
@@ -28,10 +27,8 @@
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.services.database.enumcol import DBEnum
 from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
+    IMasterStore,
+    IStore,
     )
 
 
@@ -92,8 +89,7 @@
         sspb = SeriesSourcePackageBranch(
             distroseries, pocket, sourcepackagename, branch, registrant,
             date_created)
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
-        store.add(sspb)
+        IMasterStore(SeriesSourcePackageBranch).add(sspb)
         return sspb
 
     def findForBranch(self, branch):
@@ -103,17 +99,15 @@
     def findForBranches(self, branches):
         """See `IFindOfficialBranchLinks`."""
         branch_ids = set(branch.id for branch in branches)
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(
+        return IStore(SeriesSourcePackageBranch).find(
             SeriesSourcePackageBranch,
             SeriesSourcePackageBranch.branchID.is_in(branch_ids))
 
     def findForSourcePackage(self, sourcepackage):
         """See `IFindOfficialBranchLinks`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         distroseries = sourcepackage.distroseries
         sourcepackagename = sourcepackage.sourcepackagename
-        return store.find(
+        return IStore(SeriesSourcePackageBranch).find(
             SeriesSourcePackageBranch,
             SeriesSourcePackageBranch.distroseries == distroseries.id,
             SeriesSourcePackageBranch.sourcepackagename ==
@@ -123,10 +117,9 @@
         """See `IFindOfficialBranchLinks`."""
         # To prevent circular imports.
         from lp.registry.model.distroseries import DistroSeries
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         distro = distrosourcepackage.distribution
         sourcepackagename = distrosourcepackage.sourcepackagename
-        return store.find(
+        return IStore(SeriesSourcePackageBranch).find(
             SeriesSourcePackageBranch,
             DistroSeries.distribution == distro.id,
             SeriesSourcePackageBranch.distroseries == DistroSeries.id,
@@ -140,10 +133,9 @@
         :param sourcepackage: An `ISourcePackage`.
         :param pocket: A `PackagePublishingPocket` enum item.
         """
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
         distroseries = sourcepackage.distroseries
         sourcepackagename = sourcepackage.sourcepackagename
-        return store.find(
+        return IMasterStore(SeriesSourcePackageBranch).find(
             SeriesSourcePackageBranch,
             SeriesSourcePackageBranch.distroseries == distroseries.id,
             SeriesSourcePackageBranch.sourcepackagename ==

=== modified file 'lib/lp/code/model/sourcepackagerecipe.py'
--- lib/lp/code/model/sourcepackagerecipe.py	2013-05-30 04:47:35 +0000
+++ lib/lp/code/model/sourcepackagerecipe.py	2013-06-21 02:35:32 +0000
@@ -64,7 +64,7 @@
     UTC_NOW,
     )
 from lp.services.database.datetimecol import UtcDateTimeCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/code/model/sourcepackagerecipebuild.py'
--- lib/lp/code/model/sourcepackagerecipebuild.py	2013-02-04 06:14:32 +0000
+++ lib/lp/code/model/sourcepackagerecipebuild.py	2013-06-21 02:35:32 +0000
@@ -66,7 +66,7 @@
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import DBEnum
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/code/model/sourcepackagerecipedata.py'
--- lib/lp/code/model/sourcepackagerecipedata.py	2013-01-07 02:40:55 +0000
+++ lib/lp/code/model/sourcepackagerecipedata.py	2013-06-21 02:35:32 +0000
@@ -51,7 +51,7 @@
     load_related,
     )
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.propertycache import (
     cachedproperty,
     clear_property_cache,

=== modified file 'lib/lp/code/model/tests/test_branch.py'
--- lib/lp/code/model/tests/test_branch.py	2013-05-15 04:41:33 +0000
+++ lib/lp/code/model/tests/test_branch.py	2013-06-21 02:35:32 +0000
@@ -130,7 +130,7 @@
 from lp.registry.tests.test_accesspolicy import get_policies_for_artifact
 from lp.services.config import config
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.features.testing import FeatureFixture
 from lp.services.job.tests import (
     block_on_job,

=== modified file 'lib/lp/code/model/tests/test_branchcollection.py'
--- lib/lp/code/model/tests/test_branchcollection.py	2013-05-14 14:30:09 +0000
+++ lib/lp/code/model/tests/test_branchcollection.py	2013-06-21 02:35:32 +0000
@@ -43,7 +43,7 @@
 from lp.registry.enums import PersonVisibility
 from lp.registry.interfaces.person import TeamMembershipPolicy
 from lp.registry.interfaces.pocket import PackagePublishingPocket
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.webapp.publisher import canonical_url
 from lp.testing import (
     person_logged_in,

=== modified file 'lib/lp/code/model/tests/test_branchjob.py'
--- lib/lp/code/model/tests/test_branchjob.py	2013-05-15 04:41:33 +0000
+++ lib/lp/code/model/tests/test_branchjob.py	2013-06-21 02:35:32 +0000
@@ -69,7 +69,7 @@
 from lp.scripts.helpers import TransactionFreeOperation
 from lp.services.config import config
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.features.testing import FeatureFixture
 from lp.services.identity.interfaces.emailaddress import EmailAddressStatus
 from lp.services.job.interfaces.job import JobStatus

=== modified file 'lib/lp/code/model/tests/test_branchmergequeue.py'
--- lib/lp/code/model/tests/test_branchmergequeue.py	2013-01-04 05:42:01 +0000
+++ lib/lp/code/model/tests/test_branchmergequeue.py	2013-06-21 02:35:32 +0000
@@ -10,7 +10,7 @@
 from lp.code.errors import InvalidMergeQueueConfig
 from lp.code.interfaces.branchmergequeue import IBranchMergeQueue
 from lp.code.model.branchmergequeue import BranchMergeQueue
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.testing import (
     ANONYMOUS,
     launchpadlib_for,

=== modified file 'lib/lp/code/model/tests/test_branchmergequeuecollection.py'
--- lib/lp/code/model/tests/test_branchmergequeuecollection.py	2012-09-18 18:36:09 +0000
+++ lib/lp/code/model/tests/test_branchmergequeuecollection.py	2013-06-21 02:35:32 +0000
@@ -19,7 +19,7 @@
 from lp.code.model.branchmergequeuecollection import (
     GenericBranchMergeQueueCollection,
     )
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.testing import TestCaseWithFactory
 from lp.testing.layers import DatabaseFunctionalLayer
 

=== modified file 'lib/lp/code/model/tests/test_revision.py'
--- lib/lp/code/model/tests/test_revision.py	2012-12-05 17:01:17 +0000
+++ lib/lp/code/model/tests/test_revision.py	2013-06-21 02:35:32 +0000
@@ -28,11 +28,7 @@
     RevisionSet,
     )
 from lp.registry.model.karma import Karma
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import cursor
 from lp.services.identity.interfaces.account import AccountStatus
 from lp.testing import (
@@ -79,8 +75,7 @@
         # Use an administrator to set branch privacy easily.
         TestCaseWithFactory.setUp(self, "admin@xxxxxxxxxxxxx")
         # Exclude sample data from the test results.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        store.execute(
+        IStore(RevisionCache).execute(
             "UPDATE Revision SET karma_allocated = TRUE "
             "WHERE karma_allocated IS FALSE")
 
@@ -736,8 +731,7 @@
     def setUp(self):
         # Login as an admin as we don't care about permissions here.
         TestCaseWithFactory.setUp(self, 'admin@xxxxxxxxxxxxx')
-        self.store = getUtility(IStoreSelector).get(
-            MAIN_STORE, DEFAULT_FLAVOR)
+        self.store = IStore(RevisionCache)
         # There should be no RevisionCache entries in the test data.
         assert self.store.find(RevisionCache).count() == 0
 

=== modified file 'lib/lp/code/model/tests/test_revisioncache.py'
--- lib/lp/code/model/tests/test_revisioncache.py	2012-09-28 06:25:44 +0000
+++ lib/lp/code/model/tests/test_revisioncache.py	2013-06-21 02:35:32 +0000
@@ -16,11 +16,7 @@
 
 from lp.code.interfaces.revisioncache import IRevisionCache
 from lp.code.model.revision import RevisionCache
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.testing import (
     TestCaseWithFactory,
     time_counter,
@@ -83,8 +79,7 @@
 
     def test_initially_empty(self):
         # A test just to confirm that the RevisionCache is empty.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        results = store.find(RevisionCache)
+        results = IStore(RevisionCache).find(RevisionCache)
         self.assertEqual(0, results.count())
 
     def makeCachedRevision(self, revision=None, product=None,

=== modified file 'lib/lp/code/model/tests/test_sourcepackagerecipebuild.py'
--- lib/lp/code/model/tests/test_sourcepackagerecipebuild.py	2013-01-31 23:43:04 +0000
+++ lib/lp/code/model/tests/test_sourcepackagerecipebuild.py	2013-06-21 02:35:32 +0000
@@ -33,7 +33,7 @@
 from lp.code.model.sourcepackagerecipebuild import SourcePackageRecipeBuild
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.registry.interfaces.series import SeriesStatus
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.log.logger import BufferLogger
 from lp.services.mail.sendmail import format_address
 from lp.services.webapp.authorization import check_permission

=== modified file 'lib/lp/code/scripts/tests/test_reclaim_branch_space.py'
--- lib/lp/code/scripts/tests/test_reclaim_branch_space.py	2012-09-28 06:25:44 +0000
+++ lib/lp/code/scripts/tests/test_reclaim_branch_space.py	2013-06-21 02:35:32 +0000
@@ -8,18 +8,13 @@
 import shutil
 
 import transaction
-from zope.component import getUtility
 
 from lp.code.model.branchjob import (
     BranchJob,
     BranchJobType,
     )
 from lp.services.config import config
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.scripts.tests import run_script
 from lp.testing import TestCaseWithFactory
 from lp.testing.layers import ZopelessAppServerLayer
@@ -53,9 +48,7 @@
         self.assertTrue(
             os.path.exists(mirrored_path))
         # Now pretend that the branch was deleted 8 days ago.
-        store = getUtility(IStoreSelector).get(
-            MAIN_STORE, DEFAULT_FLAVOR)
-        reclaim_job = store.find(
+        reclaim_job = IStore(BranchJob).find(
             BranchJob,
             BranchJob.job_type == BranchJobType.RECLAIM_BRANCH_SPACE).one()
         reclaim_job.job.scheduled_start -= datetime.timedelta(days=8)
@@ -88,9 +81,7 @@
         self.addCleanup(lambda: os.chmod(mirrored_path, 0777))
         db_branch.destroySelf()
         # Now pretend that the branch was deleted 8 days ago.
-        store = getUtility(IStoreSelector).get(
-            MAIN_STORE, DEFAULT_FLAVOR)
-        reclaim_job = store.find(
+        reclaim_job = IStore(BranchJob).find(
             BranchJob,
             BranchJob.job_type == BranchJobType.RECLAIM_BRANCH_SPACE).one()
         reclaim_job.job.scheduled_start -= datetime.timedelta(days=8)

=== modified file 'lib/lp/code/scripts/unscanbranch.py'
--- lib/lp/code/scripts/unscanbranch.py	2012-10-11 23:51:43 +0000
+++ lib/lp/code/scripts/unscanbranch.py	2013-06-21 02:35:32 +0000
@@ -13,7 +13,7 @@
 from lp.code.interfaces.branchlookup import IBranchLookup
 from lp.code.model.branchjob import BranchScanJob
 from lp.code.model.branchrevision import BranchRevision
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.scripts.base import LaunchpadScript
 
 

=== modified file 'lib/lp/code/tests/test_branch_access_policy_triggers.py'
--- lib/lp/code/tests/test_branch_access_policy_triggers.py	2012-10-09 01:16:09 +0000
+++ lib/lp/code/tests/test_branch_access_policy_triggers.py	2013-06-21 02:35:32 +0000
@@ -9,7 +9,7 @@
 from lp.app.enums import InformationType
 from lp.code.model.branch import Branch
 from lp.registry.interfaces.accesspolicy import IAccessPolicySource
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.testing import TestCaseWithFactory
 from lp.testing.layers import DatabaseFunctionalLayer
 

=== modified file 'lib/lp/codehosting/branchdistro.py'
--- lib/lp/codehosting/branchdistro.py	2012-01-01 02:58:52 +0000
+++ lib/lp/codehosting/branchdistro.py	2013-06-21 02:35:32 +0000
@@ -42,7 +42,7 @@
 from lp.registry.interfaces.distribution import IDistributionSet
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.services.config import config
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 
 
 def switch_branches(prefix, scheme, old_db_branch, new_db_branch):

=== modified file 'lib/lp/codehosting/scanner/tests/test_bzrsync.py'
--- lib/lp/codehosting/scanner/tests/test_bzrsync.py	2013-01-07 02:40:55 +0000
+++ lib/lp/codehosting/scanner/tests/test_bzrsync.py	2013-06-21 02:35:32 +0000
@@ -43,7 +43,7 @@
 from lp.codehosting.safe_open import SafeBranchOpener
 from lp.codehosting.scanner.bzrsync import BzrSync
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.osutils import override_environ
 from lp.testing import TestCaseWithFactory
 from lp.testing.dbuser import (

=== modified file 'lib/lp/codehosting/scanner/tests/test_mergedetection.py'
--- lib/lp/codehosting/scanner/tests/test_mergedetection.py	2012-04-10 18:43:32 +0000
+++ lib/lp/codehosting/scanner/tests/test_mergedetection.py	2013-06-21 02:35:32 +0000
@@ -30,7 +30,7 @@
     run_as_db_user,
     )
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.osutils import override_environ
 from lp.testing import (
     TestCase,

=== modified file 'lib/lp/codehosting/upgrade.py'
--- lib/lp/codehosting/upgrade.py	2012-08-30 09:19:50 +0000
+++ lib/lp/codehosting/upgrade.py	2013-06-21 02:35:32 +0000
@@ -38,7 +38,7 @@
 from lp.codehosting.bzrutils import read_locked
 from lp.codehosting.safe_open import safe_open
 from lp.codehosting.vfs.branchfs import get_real_branch_path
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 
 
 class AlreadyUpgraded(Exception):

=== modified file 'lib/lp/hardwaredb/model/hwdb.py'
--- lib/lp/hardwaredb/model/hwdb.py	2013-05-02 00:40:14 +0000
+++ lib/lp/hardwaredb/model/hwdb.py	2013-06-21 02:35:32 +0000
@@ -108,11 +108,7 @@
     )
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,
@@ -235,8 +231,7 @@
 
     def getBySubmissionKey(self, submission_key, user=None):
         """See `IHWSubmissionSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(
+        return IStore(HWSubmission).find(
             HWSubmission,
             And(HWSubmission.submission_key == submission_key,
                 _userCanAccessSubmissionStormClause(user))).one()
@@ -281,22 +276,19 @@
 
     def getByStatus(self, status, user=None):
         """See `IHWSubmissionSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result_set = store.find(HWSubmission,
-                                HWSubmission.status == status,
-                                _userCanAccessSubmissionStormClause(user))
         # Provide a stable order. Sorting by id, to get the oldest
         # submissions first. When date_submitted has an index, we could
         # sort by that first.
-        result_set.order_by(HWSubmission.id)
-        return result_set
+        return IStore(HWSubmission).find(
+            HWSubmission, HWSubmission.status == status,
+            _userCanAccessSubmissionStormClause(user)).order_by(
+                HWSubmission.id)
 
     def search(self, user=None, device=None, driver=None, distribution=None,
                distroseries=None, architecture=None, owner=None,
                created_before=None, created_after=None,
                submitted_before=None, submitted_after=None):
         """See `IHWSubmissionSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         args = []
         if device is not None:
             args.append(HWDeviceDriverLink.device == HWDevice.id)
@@ -339,19 +331,16 @@
         if submitted_after is not None:
             args.append(HWSubmission.date_submitted > submitted_after)
 
-        result_set = store.find(
-            HWSubmission,
-            _userCanAccessSubmissionStormClause(user),
-            *args)
         # Many devices are associated with more than one driver, even
         # for one submission, hence we may have more than one
         # HWSubmissionDevice record and more than one HWDeviceDriverLink
         # for one device and one submission matching the WHERE clause
         # defined above. This leads to duplicate results without a
         # DISTINCT clause.
-        result_set.config(distinct=True)
-        result_set.order_by(HWSubmission.id)
-        return result_set
+        return IStore(HWSubmission).find(
+            HWSubmission,
+            _userCanAccessSubmissionStormClause(user),
+            *args).config(distinct=True).order_by(HWSubmission.id)
 
     def _submissionsSubmitterSelects(
         self, target_column, bus, vendor_id, product_id, driver_name,
@@ -404,7 +393,7 @@
         self, bus=None, vendor_id=None, product_id=None, driver_name=None,
         package_name=None, distro_target=None):
         """See `IHWSubmissionSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(HWSubmission)
         submissions_with_device_select, all_submissions_select = (
             self._submissionsSubmitterSelects(
                 Count(), bus, vendor_id, product_id, driver_name,
@@ -419,7 +408,7 @@
         self, bus=None, vendor_id=None, product_id=None, driver_name=None,
         package_name=None, distro_target=None):
         """See `IHWSubmissionSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(HWSubmission)
         submitters_with_device_select, all_submitters_select = (
             self._submissionsSubmitterSelects(
                 HWSubmission.raw_emailaddress, bus, vendor_id, product_id,
@@ -442,7 +431,7 @@
         package_name=None, bug_ids=None, bug_tags=None, affected_by_bug=False,
         subscribed_to_bug=False, user=None):
         """See `IHWSubmissionSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(HWSubmission)
         tables, clauses = make_submission_device_statistics_clause(
                 bus, vendor_id, product_id, driver_name, package_name, False)
         tables.append(HWSubmission)
@@ -512,8 +501,6 @@
         self, bug_ids=None, bug_tags=None, affected_by_bug=False,
         subscribed_to_bug=False, user=None):
         """See `IHWSubmissionSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-
         if ((bug_ids is None or len(bug_ids) == 0) and
             (bug_tags is None or len(bug_tags) == 0)):
             raise ParameterError('bug_ids or bug_tags must be supplied.')
@@ -564,7 +551,7 @@
         return [
             (person_name, HWBus.items[bus_id], vendor_id, product_id)
              for person_name, bus_id, vendor_id, product_id
-             in store.execute(query)]
+             in IStore(HWSubmission).execute(query)]
 
 
 class HWSystemFingerprint(SQLBase):
@@ -746,15 +733,12 @@
 
     def get(self, id):
         """See `IHWVendorIDSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(HWVendorID, HWVendorID.id == id).one()
+        return IStore(HWVendorID).find(HWVendorID, HWVendorID.id == id).one()
 
     def idsForBus(self, bus):
         """See `IHWVendorIDSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result_set = store.find(HWVendorID, bus=bus)
-        result_set.order_by(HWVendorID.vendor_id_for_bus)
-        return result_set
+        return IStore(HWVendorID).find(HWVendorID, bus=bus).order_by(
+            HWVendorID.vendor_id_for_bus)
 
 
 class HWDevice(SQLBase):
@@ -812,27 +796,22 @@
     @property
     def drivers(self):
         """See `IHWDevice.`"""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result_set = store.find(HWDriver,
-                                HWDeviceDriverLink.driver == HWDriver.id,
-                                HWDeviceDriverLink.device == self)
-        result_set.order_by((HWDriver.package_name, HWDriver.name))
-        return result_set
+        return IStore(HWDriver).find(
+            HWDriver, HWDeviceDriverLink.driver == HWDriver.id,
+            HWDeviceDriverLink.device == self).order_by(
+                HWDriver.package_name, HWDriver.name)
 
     @property
     def classes(self):
         """See `IHWDevice.`"""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result_set = store.find(
+        return IStore(HWDeviceClass).find(
             HWDeviceClass,
-            HWDeviceClass.device == self.id)
-        result_set.order_by(HWDeviceClass.main_class, HWDeviceClass.sub_class)
-        return result_set
+            HWDeviceClass.device == self.id).order_by(
+                HWDeviceClass.main_class, HWDeviceClass.sub_class)
 
     def getOrCreateDeviceClass(self, main_class, sub_class=None):
         """See `IHWDevice.`"""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result_set = store.find(
+        result_set = IStore(HWDeviceClass).find(
             HWDeviceClass,
             HWDeviceClass.device == self.id,
             HWDeviceClass.main_class == main_class,
@@ -845,7 +824,7 @@
 
     def removeDeviceClass(self, main_class, sub_class=None):
         """See `IHWDevice.`"""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(HWDeviceClass)
         result_set = store.find(
             HWDeviceClass,
             HWDeviceClass.device == self.id,
@@ -905,13 +884,11 @@
 
     def getByID(self, id):
         """See `IHWDeviceSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(HWDevice, HWDevice.id == id).one()
+        return IStore(HWDevice).find(HWDevice, HWDevice.id == id).one()
 
     def search(self, bus, vendor_id, product_id=None):
         """See `IHWDeviceSet`."""
         bus_vendor = HWVendorIDSet().getByBusAndVendorID(bus, vendor_id)
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         args = []
         if product_id is not None:
             if not isValidProductID(bus, product_id):
@@ -919,10 +896,9 @@
                     '%s is not a valid product ID for %s'
                     % (repr(product_id), bus.title))
             args.append(HWDevice.bus_product_id == product_id)
-        result_set = store.find(
-            HWDevice, HWDevice.bus_vendor == bus_vendor, *args)
-        result_set.order_by(HWDevice.id)
-        return result_set
+        return IStore(HWDevice).find(
+            HWDevice, HWDevice.bus_vendor == bus_vendor, *args).order_by(
+                HWDevice.id)
 
 
 class HWDeviceNameVariant(SQLBase):
@@ -991,7 +967,7 @@
 
     def getByPackageAndName(self, package_name, name):
         """See `IHWDriverSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(HWDriver)
         if package_name in (None, ''):
             return store.find(
                 HWDriver,
@@ -1019,7 +995,6 @@
 
     def search(self, package_name=None, name=None):
         """See `IHWDriverSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         args = []
         if package_name is not None:
             if len(package_name) == 0:
@@ -1029,28 +1004,23 @@
                 args.append(HWDriver.package_name == package_name)
         if name != None:
             args.append(HWDriver.name == name)
-        result_set = store.find(HWDriver, *args)
-        return result_set.order_by(HWDriver.id)
+        return IStore(HWDriver).find(HWDriver, *args).order_by(HWDriver.id)
 
     def getByID(self, id):
         """See `IHWDriverSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(HWDriver, HWDriver.id == id).one()
+        return IStore(HWDriver).find(HWDriver, HWDriver.id == id).one()
 
     def all_driver_names(self):
         """See `IHWDriverSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result = store.find(HWDriverName)
-        result.order_by(HWDriverName.name)
-        return result
+        return IStore(HWDriverName).find(
+            HWDriverName).order_by(HWDriverName.name)
 
     def all_package_names(self):
         """See `IHWDriverSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         # XXX Abel Deuring 2009-06-19 The clause package_name != None
         # can be removed once bug #306265 is fixed.
-        result = store.find(HWDriverPackageName,
-                            HWDriverPackageName.package_name != None)
+        result = IStore(HWDriverPackageName).find(
+            HWDriverPackageName, HWDriverPackageName.package_name != None)
         result.order_by(HWDriverPackageName.package_name)
         return result
 
@@ -1124,8 +1094,8 @@
 
     def get(self, id):
         """See `IHWDeviceClassSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(HWDeviceClass, HWDeviceClass.id == id).one()
+        return IStore(HWDeviceClass).find(
+            HWDeviceClass, HWDeviceClass.id == id).one()
 
 
 class HWSubmissionDevice(SQLBase):
@@ -1174,16 +1144,13 @@
 
     def get(self, id):
         """See `IHWSubmissionDeviceSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(
+        return IStore(HWSubmissionDevice).find(
             HWSubmissionDevice, HWSubmissionDevice.id == id).one()
 
     def numDevicesInSubmissions(
         self, bus=None, vendor_id=None, product_id=None, driver_name=None,
         package_name=None, distro_target=None):
         """See `IHWSubmissionDeviceSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-
         tables, where_clauses = make_submission_device_statistics_clause(
             bus, vendor_id, product_id, driver_name, package_name, False)
 
@@ -1195,7 +1162,7 @@
             where_clauses.append(
                 HWSubmissionDevice.submission == HWSubmission.id)
 
-        result = store.execute(
+        result = IStore(HWSubmissionDevice).execute(
             Select(
                 columns=[Count()], tables=tables, where=And(*where_clauses)))
         return result.get_one()[0]

=== modified file 'lib/lp/registry/browser/tests/test_distroseries.py'
--- lib/lp/registry/browser/tests/test_distroseries.py	2013-05-09 08:53:01 +0000
+++ lib/lp/registry/browser/tests/test_distroseries.py	2013-06-21 02:35:32 +0000
@@ -54,11 +54,7 @@
 from lp.registry.interfaces.series import SeriesStatus
 from lp.services.config import config
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import flush_database_caches
 from lp.services.features.testing import FeatureFixture
 from lp.services.propertycache import get_property_cache
@@ -530,9 +526,9 @@
                 "member of Team Teamy Team Team may be able to help."))
 
     def load_afresh(self, thing):
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
         naked_thing = removeSecurityProxy(thing)
-        naked_thing = store.get(naked_thing.__class__, naked_thing.id)
+        naked_thing = IStore(naked_thing.__class__).get(
+            naked_thing.__class__, naked_thing.id)
         return ProxyFactory(naked_thing)
 
     def fail_job_with_error(self, job, error):

=== modified file 'lib/lp/registry/browser/tests/test_pillar_sharing.py'
--- lib/lp/registry/browser/tests/test_pillar_sharing.py	2013-02-07 06:10:38 +0000
+++ lib/lp/registry/browser/tests/test_pillar_sharing.py	2013-06-21 02:35:32 +0000
@@ -28,7 +28,7 @@
 from lp.registry.interfaces.accesspolicy import IAccessPolicyGrantFlatSource
 from lp.registry.model.pillar import PillarPerson
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.webapp.interfaces import StormRangeFactoryError
 from lp.services.webapp.publisher import canonical_url
 from lp.testing import (

=== modified file 'lib/lp/registry/browser/tests/test_product.py'
--- lib/lp/registry/browser/tests/test_product.py	2013-02-07 06:10:38 +0000
+++ lib/lp/registry/browser/tests/test_product.py	2013-06-21 02:35:32 +0000
@@ -41,7 +41,7 @@
     )
 from lp.registry.model.product import Product
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.webapp.publisher import canonical_url
 from lp.testing import (
     BrowserTestCase,

=== modified file 'lib/lp/registry/doc/person.txt'
--- lib/lp/registry/doc/person.txt	2013-05-01 21:23:16 +0000
+++ lib/lp/registry/doc/person.txt	2013-06-21 02:35:32 +0000
@@ -141,7 +141,7 @@
     <DBItem AccountStatus.NOACCOUNT...
 
     >>> from lp.services.identity.model.account import Account
-    >>> from lp.services.database.lpstorm import IMasterStore
+    >>> from lp.services.database.interfaces import IMasterStore
     >>> account = IMasterStore(Account).get(Account, p.accountID)
     >>> account.reactivate("Activated by doc test.")
     >>> p.account_status

=== modified file 'lib/lp/registry/model/accesspolicy.py'
--- lib/lp/registry/model/accesspolicy.py	2012-10-09 03:32:28 +0000
+++ lib/lp/registry/model/accesspolicy.py	2013-06-21 02:35:32 +0000
@@ -55,7 +55,7 @@
 from lp.services.database.bulk import create
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import DBEnum
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.stormbase import StormBase
 
 

=== modified file 'lib/lp/registry/model/distribution.py'
--- lib/lp/registry/model/distribution.py	2013-05-01 21:23:16 +0000
+++ lib/lp/registry/model/distribution.py	2013-06-21 02:35:32 +0000
@@ -140,7 +140,7 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     quote,
     SQLBase,

=== modified file 'lib/lp/registry/model/distributionmirror.py'
--- lib/lp/registry/model/distributionmirror.py	2013-05-01 18:04:09 +0000
+++ lib/lp/registry/model/distributionmirror.py	2013-06-21 02:35:32 +0000
@@ -68,12 +68,7 @@
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,
@@ -655,7 +650,7 @@
         if limit is not None:
             query += " LIMIT %d" % limit
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(MirrorDistroArchSeries)
         ids = ", ".join(str(id)
                         for (id, date_created) in store.execute(query))
         query = '1 = 2'

=== modified file 'lib/lp/registry/model/distributionsourcepackage.py'
--- lib/lp/registry/model/distributionsourcepackage.py	2013-05-02 00:40:14 +0000
+++ lib/lp/registry/model/distributionsourcepackage.py	2013-06-21 02:35:32 +0000
@@ -55,7 +55,7 @@
     SourcePackageQuestionTargetMixin,
     )
 from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import sqlvalues
 from lp.services.propertycache import cachedproperty
 from lp.soyuz.enums import (

=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py	2013-02-06 09:15:36 +0000
+++ lib/lp/registry/model/distroseries.py	2013-06-21 02:35:32 +0000
@@ -96,12 +96,7 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    SLAVE_FLAVOR,
-    )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     flush_database_caches,
     flush_database_updates,
@@ -1073,8 +1068,6 @@
 
     def searchPackages(self, text):
         """See `IDistroSeries`."""
-
-        store = getUtility(IStoreSelector).get(MAIN_STORE, SLAVE_FLAVOR)
         find_spec = (
             DistroSeriesPackageCache,
             BinaryPackageName,
@@ -1090,7 +1083,7 @@
         # Note: When attempting to convert the query below into straight
         # Storm expressions, a 'tuple index out-of-range' error was always
         # raised.
-        package_caches = store.using(*origin).find(
+        package_caches = IStore(BinaryPackageName).using(*origin).find(
             find_spec,
             DistroSeriesPackageCache.distroseries == self,
             DistroSeriesPackageCache.archiveID.is_in(
@@ -1487,15 +1480,12 @@
 
     def translatables(self):
         """See `IDistroSeriesSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, SLAVE_FLAVOR)
         # Join POTemplate distinctly to only get entries with available
         # translations.
-        result_set = store.using((DistroSeries, POTemplate)).find(
+        return IStore(DistroSeries).using((DistroSeries, POTemplate)).find(
             DistroSeries,
             DistroSeries.hide_all_translations == False,
-            DistroSeries.id == POTemplate.distroseriesID)
-        result_set = result_set.config(distinct=True)
-        return result_set
+            DistroSeries.id == POTemplate.distroseriesID).config(distinct=True)
 
     def queryByName(self, distribution, name):
         """See `IDistroSeriesSet`."""

=== modified file 'lib/lp/registry/model/distroseriesdifference.py'
--- lib/lp/registry/model/distroseriesdifference.py	2013-03-27 04:04:28 +0000
+++ lib/lp/registry/model/distroseriesdifference.py	2013-06-21 02:35:32 +0000
@@ -70,7 +70,7 @@
 from lp.services.database import bulk
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import DBEnum
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/registry/model/distroseriesdifferencecomment.py'
--- lib/lp/registry/model/distroseriesdifferencecomment.py	2012-01-01 02:58:52 +0000
+++ lib/lp/registry/model/distroseriesdifferencecomment.py	2013-06-21 02:35:32 +0000
@@ -27,7 +27,7 @@
     IDistroSeriesDifferenceCommentSource,
     )
 from lp.registry.model.sourcepackagename import SourcePackageName
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/registry/model/distroseriesparent.py'
--- lib/lp/registry/model/distroseriesparent.py	2011-12-30 06:14:56 +0000
+++ lib/lp/registry/model/distroseriesparent.py	2013-06-21 02:35:32 +0000
@@ -25,7 +25,7 @@
     )
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/registry/model/karma.py'
--- lib/lp/registry/model/karma.py	2013-05-01 18:04:09 +0000
+++ lib/lp/registry/model/karma.py	2013-06-21 02:35:32 +0000
@@ -41,7 +41,7 @@
 from lp.registry.interfaces.projectgroup import IProjectGroup
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.datetimecol import UtcDateTimeCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,
@@ -183,7 +183,7 @@
         Return None if it's not found.
         """
         return IStore(KarmaCache).find(
-            KarmaCache, 
+            KarmaCache,
             KarmaCache.personID == person_id,
             KarmaCache.categoryID == category_id,
             KarmaCache.productID == product_id,

=== modified file 'lib/lp/registry/model/mailinglist.py'
--- lib/lp/registry/model/mailinglist.py	2013-01-10 23:53:09 +0000
+++ lib/lp/registry/model/mailinglist.py	2013-06-21 02:35:32 +0000
@@ -72,7 +72,7 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/registry/model/milestone.py'
--- lib/lp/registry/model/milestone.py	2013-04-03 03:09:04 +0000
+++ lib/lp/registry/model/milestone.py	2013-06-21 02:35:32 +0000
@@ -65,7 +65,7 @@
     )
 from lp.registry.model.productrelease import ProductRelease
 from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import SQLBase
 from lp.services.propertycache import get_property_cache
 from lp.services.webapp.sorting import expand_numbers
@@ -142,7 +142,7 @@
 @error_status(httplib.BAD_REQUEST)
 class InvalidTags(Exception):
     """Raised when tags are invalid."""
-    
+
     def __init__(self, msg='Tags are invalid.'):
         super(InvalidTags, self).__init__(msg)
 

=== modified file 'lib/lp/registry/model/nameblacklist.py'
--- lib/lp/registry/model/nameblacklist.py	2012-01-01 02:58:52 +0000
+++ lib/lp/registry/model/nameblacklist.py	2013-06-21 02:35:32 +0000
@@ -22,7 +22,7 @@
     INameBlacklistSet,
     )
 from lp.registry.model.person import Person
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.stormbase import StormBase
 
 

=== modified file 'lib/lp/registry/model/person.py'
--- lib/lp/registry/model/person.py	2013-06-21 00:44:46 +0000
+++ lib/lp/registry/model/person.py	2013-06-21 02:35:32 +0000
@@ -245,7 +245,7 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.policy import MasterDatabasePolicy
 from lp.services.database.sqlbase import (
     cursor,

=== modified file 'lib/lp/registry/model/persontransferjob.py'
--- lib/lp/registry/model/persontransferjob.py	2013-06-05 07:26:58 +0000
+++ lib/lp/registry/model/persontransferjob.py	2013-06-21 02:35:32 +0000
@@ -52,7 +52,7 @@
 from lp.services.config import config
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/registry/model/pillar.py'
--- lib/lp/registry/model/pillar.py	2013-01-07 02:40:55 +0000
+++ lib/lp/registry/model/pillar.py	2013-06-21 02:35:32 +0000
@@ -43,11 +43,7 @@
 from lp.registry.interfaces.projectgroup import IProjectGroupSet
 from lp.registry.model.featuredproject import FeaturedProject
 from lp.services.config import config
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,
@@ -88,9 +84,8 @@
 
     def __contains__(self, name):
         """See `IPillarNameSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         name = ensure_unicode(name)
-        result = store.execute("""
+        result = IStore(PillarName).execute("""
             SELECT TRUE
             FROM PillarName
             WHERE (id IN (SELECT alias_for FROM PillarName WHERE name=?)
@@ -120,7 +115,6 @@
         # works better with SQLObject too.
 
         # Retrieve information out of the PillarName table.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         query = """
             SELECT id, product, project, distribution
             FROM PillarName
@@ -134,7 +128,7 @@
         else:
             query %= ""
         name = ensure_unicode(name)
-        result = store.execute(query, [name, name])
+        result = IStore(PillarName).execute(query, [name, name])
         row = result.get_one()
         if row is None:
             return None
@@ -185,12 +179,12 @@
                  lower(Distribution.title) = lower(%(text)s)
                 )
             ''' % sqlvalues(text=ensure_unicode(text)))
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         columns = [
             PillarName, OtherPillarName, Product, ProjectGroup, Distribution]
         for column in extra_columns:
             columns.append(column)
-        return store.using(*origin).find(tuple(columns), conditions)
+        return IStore(PillarName).using(*origin).find(
+            tuple(columns), conditions)
 
     def count_search_matches(self, text):
         result = self.build_search_query(text)

=== modified file 'lib/lp/registry/model/product.py'
--- lib/lp/registry/model/product.py	2013-05-01 18:49:40 +0000
+++ lib/lp/registry/model/product.py	2013-06-21 02:35:32 +0000
@@ -189,12 +189,7 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,
@@ -2059,20 +2054,16 @@
         """See `IProductSet`."""
         # Circular.
         from lp.bugs.model.bugtracker import BugTracker
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         conditions = [Product.remote_product == None]
         if bugtracker_type is not None:
             conditions.extend([
                 Product.bugtracker == BugTracker.id,
                 BugTracker.bugtrackertype == bugtracker_type,
                 ])
-        return store.find(Product, And(*conditions))
+        return IStore(Product).find(Product, And(*conditions))
 
     def getSFLinkedProductsWithNoneRemoteProduct(self):
         """See `IProductSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        conditions = And(
-            Product.remote_product == None,
-            Product.sourceforgeproject != None)
-
-        return store.find(Product, conditions)
+        return IStore(Product).find(
+            Product,
+            Product.remote_product == None, Product.sourceforgeproject != None)

=== modified file 'lib/lp/registry/model/productjob.py'
--- lib/lp/registry/model/productjob.py	2012-10-07 23:42:34 +0000
+++ lib/lp/registry/model/productjob.py	2013-06-21 02:35:32 +0000
@@ -65,7 +65,7 @@
 from lp.services.config import config
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/registry/model/productrelease.py'
--- lib/lp/registry/model/productrelease.py	2013-05-01 00:23:31 +0000
+++ lib/lp/registry/model/productrelease.py	2013-06-21 02:35:32 +0000
@@ -44,12 +44,7 @@
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,
@@ -172,7 +167,7 @@
             name=filename, size=file_size, file=file_obj,
             contentType=content_type)
         if signature_filename is not None and signature_content is not None:
-            # XXX: StevenK 2013-02-06 bug=1116954: We should not need to 
+            # XXX: StevenK 2013-02-06 bug=1116954: We should not need to
             # refetch the file content from the request, since the passed in
             # one has been wrongly encoded.
             if from_api:
@@ -270,13 +265,12 @@
         from lp.registry.model.milestone import Milestone
         if len(list(series)) == 0:
             return EmptyResultSet()
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         series_ids = [s.id for s in series]
-        result = store.find(
+        return IStore(ProductRelease).find(
             ProductRelease,
             And(ProductRelease.milestone == Milestone.id),
-                Milestone.productseriesID.is_in(series_ids))
-        return result.order_by(Desc(ProductRelease.datereleased))
+                Milestone.productseriesID.is_in(series_ids)).order_by(
+                    Desc(ProductRelease.datereleased))
 
     def getFilesForReleases(self, releases):
         """See `IProductReleaseSet`."""

=== modified file 'lib/lp/registry/model/sharingjob.py'
--- lib/lp/registry/model/sharingjob.py	2013-01-22 05:07:31 +0000
+++ lib/lp/registry/model/sharingjob.py	2013-06-21 02:35:32 +0000
@@ -77,7 +77,7 @@
 from lp.registry.model.teammembership import TeamParticipation
 from lp.services.config import config
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.stormbase import StormBase
 from lp.services.job.model.job import (
     EnumeratedSubclass,

=== modified file 'lib/lp/registry/model/sourcepackage.py'
--- lib/lp/registry/model/sourcepackage.py	2013-01-30 01:41:33 +0000
+++ lib/lp/registry/model/sourcepackage.py	2013-06-21 02:35:32 +0000
@@ -59,7 +59,7 @@
     PackagingUtil,
     )
 from lp.registry.model.suitesourcepackage import SuiteSourcePackage
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     flush_database_updates,
     sqlvalues,

=== modified file 'lib/lp/registry/model/teammembership.py'
--- lib/lp/registry/model/teammembership.py	2013-01-07 02:40:55 +0000
+++ lib/lp/registry/model/teammembership.py	2013-06-21 02:35:32 +0000
@@ -56,7 +56,7 @@
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     cursor,
     flush_database_updates,

=== modified file 'lib/lp/registry/personmerge.py'
--- lib/lp/registry/personmerge.py	2013-06-05 07:11:29 +0000
+++ lib/lp/registry/personmerge.py	2013-06-21 02:35:32 +0000
@@ -25,7 +25,7 @@
     TeamMembershipStatus,
     )
 from lp.services.database import postgresql
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     cursor,
     sqlvalues,

=== modified file 'lib/lp/registry/scripts/populate_distroseriesdiff.py'
--- lib/lp/registry/scripts/populate_distroseriesdiff.py	2012-01-17 21:45:24 +0000
+++ lib/lp/registry/scripts/populate_distroseriesdiff.py	2013-06-21 02:35:32 +0000
@@ -36,7 +36,7 @@
 from lp.registry.model.distroseries import DistroSeries
 from lp.registry.model.distroseriesdifference import DistroSeriesDifference
 from lp.registry.model.distroseriesparent import DistroSeriesParent
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     quote,
     quote_identifier,

=== modified file 'lib/lp/registry/scripts/productreleasefinder/finder.py'
--- lib/lp/registry/scripts/productreleasefinder/finder.py	2012-11-26 08:33:03 +0000
+++ lib/lp/registry/scripts/productreleasefinder/finder.py	2013-06-21 02:35:32 +0000
@@ -36,7 +36,7 @@
     read_transaction,
     write_transaction,
     )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.librarian.model import LibraryFileAlias
 
 

=== modified file 'lib/lp/registry/scripts/teamparticipation.py'
--- lib/lp/registry/scripts/teamparticipation.py	2012-09-28 06:25:44 +0000
+++ lib/lp/registry/scripts/teamparticipation.py	2013-06-21 02:35:32 +0000
@@ -24,14 +24,12 @@
     )
 
 import transaction
-from zope.component import getUtility
 
 from lp.registry.interfaces.teammembership import ACTIVE_STATES
+from lp.registry.model.teammembership import TeamParticipation
 from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    SLAVE_FLAVOR,
+    IMasterStore,
+    ISlaveStore,
     )
 from lp.services.database.sqlbase import (
     quote,
@@ -40,22 +38,6 @@
 from lp.services.scripts.base import LaunchpadScriptFailure
 
 
-def get_master_store():
-    """Return a master store.
-
-    Errors in `TeamPartipation` must be fixed in the master.
-    """
-    return getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
-
-
-def get_slave_store():
-    """Return a slave store.
-
-    Errors in `TeamPartipation` can be detected using a replicated copy.
-    """
-    return getUtility(IStoreSelector).get(MAIN_STORE, SLAVE_FLAVOR)
-
-
 def check_teamparticipation_circular(log):
     """Check circular references.
 
@@ -69,7 +51,7 @@
            AND tp.person = tp2.team
            AND tp.id != tp2.id;
         """
-    circular_references = list(get_slave_store().execute(query))
+    circular_references = list(ISlaveStore(TeamParticipation).execute(query))
     if len(circular_references) > 0:
         raise LaunchpadScriptFailure(
             "Circular references found: %s" % circular_references)
@@ -109,7 +91,8 @@
 
 def fetch_team_participation_info(log):
     """Fetch people, teams, memberships and participations."""
-    slurp = partial(execute_long_query, get_slave_store(), log, 10000)
+    slurp = partial(
+        execute_long_query, ISlaveStore(TeamParticipation), log, 10000)
 
     people = dict(
         slurp(
@@ -228,7 +211,7 @@
          WHERE team = %(team)s
            AND person IN %(people)s
         """)
-    store = get_master_store()
+    store = IMasterStore(TeamParticipation)
     for error in errors:
         if error.type == "missing":
             for person in error.people:

=== modified file 'lib/lp/registry/services/sharingservice.py'
--- lib/lp/registry/services/sharingservice.py	2013-02-12 22:30:49 +0000
+++ lib/lp/registry/services/sharingservice.py	2013-06-21 02:35:32 +0000
@@ -71,7 +71,7 @@
 from lp.registry.model.product import Product
 from lp.registry.model.teammembership import TeamParticipation
 from lp.services.database.bulk import load
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.stormexpr import ColumnSelect
 from lp.services.searchbuilder import any
 from lp.services.webapp.authorization import (

=== modified file 'lib/lp/registry/tests/test_accesspolicy.py'
--- lib/lp/registry/tests/test_accesspolicy.py	2012-09-18 19:41:02 +0000
+++ lib/lp/registry/tests/test_accesspolicy.py	2013-06-21 02:35:32 +0000
@@ -24,7 +24,7 @@
     )
 from lp.registry.model.accesspolicy import reconcile_access_for_artifact
 from lp.registry.model.person import Person
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.testing import TestCaseWithFactory
 from lp.testing.layers import DatabaseFunctionalLayer
 from lp.testing.matchers import Provides

=== modified file 'lib/lp/registry/tests/test_distributionsourcepackage.py'
--- lib/lp/registry/tests/test_distributionsourcepackage.py	2012-01-20 15:42:44 +0000
+++ lib/lp/registry/tests/test_distributionsourcepackage.py	2013-06-21 02:35:32 +0000
@@ -17,7 +17,7 @@
     DistributionSourcePackageInDatabase,
     )
 from lp.registry.model.karma import KarmaTotalCache
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import flush_database_updates
 from lp.soyuz.enums import PackagePublishingStatus
 from lp.soyuz.tests.test_publishing import SoyuzTestPublisher

=== modified file 'lib/lp/registry/tests/test_nameblacklist.py'
--- lib/lp/registry/tests/test_nameblacklist.py	2012-01-01 02:58:52 +0000
+++ lib/lp/registry/tests/test_nameblacklist.py	2013-06-21 02:35:32 +0000
@@ -14,7 +14,7 @@
     INameBlacklist,
     INameBlacklistSet,
     )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.webapp.authorization import check_permission
 from lp.testing import (
     ANONYMOUS,

=== modified file 'lib/lp/registry/tests/test_oopsreferences.py'
--- lib/lp/registry/tests/test_oopsreferences.py	2012-06-11 03:49:49 +0000
+++ lib/lp/registry/tests/test_oopsreferences.py	2013-06-21 02:35:32 +0000
@@ -13,7 +13,7 @@
 from pytz import utc
 
 from lp.registry.model.oopsreferences import referenced_oops
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.messages.model.message import (
     Message,
     MessageSet,

=== modified file 'lib/lp/registry/tests/test_person_merge_job.py'
--- lib/lp/registry/tests/test_person_merge_job.py	2012-10-03 04:52:37 +0000
+++ lib/lp/registry/tests/test_person_merge_job.py	2013-06-21 02:35:32 +0000
@@ -16,7 +16,7 @@
     IPersonMergeJob,
     IPersonMergeJobSource,
     )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.features.testing import FeatureFixture
 from lp.services.identity.interfaces.emailaddress import EmailAddressStatus
 from lp.services.job.interfaces.job import JobStatus

=== modified file 'lib/lp/registry/tests/test_personset.py'
--- lib/lp/registry/tests/test_personset.py	2013-06-21 00:43:21 +0000
+++ lib/lp/registry/tests/test_personset.py	2013-06-21 02:35:32 +0000
@@ -24,7 +24,7 @@
     )
 from lp.registry.model.codeofconduct import SignedCodeOfConduct
 from lp.registry.model.person import Person
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/registry/tests/test_product.py'
--- lib/lp/registry/tests/test_product.py	2013-05-01 21:23:16 +0000
+++ lib/lp/registry/tests/test_product.py	2013-06-21 02:35:32 +0000
@@ -91,7 +91,7 @@
     UnDeactivateable,
     )
 from lp.registry.model.productlicense import ProductLicense
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.webapp.authorization import check_permission
 from lp.services.webapp.escaping import html_escape
 from lp.testing import (

=== modified file 'lib/lp/registry/tests/test_productjob.py'
--- lib/lp/registry/tests/test_productjob.py	2012-10-08 06:13:17 +0000
+++ lib/lp/registry/tests/test_productjob.py	2013-06-21 02:35:32 +0000
@@ -51,7 +51,7 @@
     SevenDayCommercialExpirationJob,
     ThirtyDayCommercialExpirationJob,
     )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.job.interfaces.job import JobStatus
 from lp.services.log.logger import BufferLogger
 from lp.services.propertycache import clear_property_cache

=== modified file 'lib/lp/registry/tests/test_productrelease.py'
--- lib/lp/registry/tests/test_productrelease.py	2013-01-25 05:25:34 +0000
+++ lib/lp/registry/tests/test_productrelease.py	2013-06-21 02:35:32 +0000
@@ -16,7 +16,7 @@
     IProductReleaseSet,
     UpstreamFileType,
     )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.testing import (
     person_logged_in,
     TestCaseWithFactory,

=== modified file 'lib/lp/registry/tests/test_productseries.py'
--- lib/lp/registry/tests/test_productseries.py	2013-04-03 05:04:11 +0000
+++ lib/lp/registry/tests/test_productseries.py	2013-06-21 02:35:32 +0000
@@ -34,7 +34,7 @@
     IProductSeriesSet,
     )
 from lp.registry.interfaces.series import SeriesStatus
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.testing import (
     ANONYMOUS,
     celebrity_logged_in,

=== modified file 'lib/lp/registry/tests/test_sharingjob.py'
--- lib/lp/registry/tests/test_sharingjob.py	2012-10-10 17:30:44 +0000
+++ lib/lp/registry/tests/test_sharingjob.py	2013-06-21 02:35:32 +0000
@@ -35,7 +35,7 @@
     SharingJobDerived,
     SharingJobType,
     )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.features.testing import FeatureFixture
 from lp.services.job.interfaces.job import JobStatus
 from lp.services.job.tests import block_on_job

=== modified file 'lib/lp/registry/tests/test_team.py'
--- lib/lp/registry/tests/test_team.py	2012-10-18 19:07:12 +0000
+++ lib/lp/registry/tests/test_team.py	2013-06-21 02:35:32 +0000
@@ -30,7 +30,7 @@
     )
 from lp.registry.interfaces.teammembership import TeamMembershipStatus
 from lp.registry.model.persontransferjob import PersonTransferJob
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.identity.interfaces.emailaddress import IEmailAddressSet
 from lp.services.identity.model.emailaddress import EmailAddress
 from lp.soyuz.enums import ArchiveStatus

=== modified file 'lib/lp/registry/tests/test_teammembership.py'
--- lib/lp/registry/tests/test_teammembership.py	2013-03-12 03:18:18 +0000
+++ lib/lp/registry/tests/test_teammembership.py	2013-06-21 02:35:32 +0000
@@ -51,7 +51,7 @@
     fix_teamparticipation_consistency,
     )
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     cursor,
     flush_database_caches,

=== modified file 'lib/lp/registry/tests/test_user_vocabularies.py'
--- lib/lp/registry/tests/test_user_vocabularies.py	2013-05-10 08:28:46 +0000
+++ lib/lp/registry/tests/test_user_vocabularies.py	2013-06-21 02:35:32 +0000
@@ -14,7 +14,7 @@
     PersonVisibility,
     )
 from lp.registry.model.person import Person
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.testing import (
     ANONYMOUS,
     login,

=== modified file 'lib/lp/registry/vocabularies.py'
--- lib/lp/registry/vocabularies.py	2012-11-28 06:33:53 +0000
+++ lib/lp/registry/vocabularies.py	2013-06-21 02:35:32 +0000
@@ -157,12 +157,7 @@
 from lp.registry.model.teammembership import TeamParticipation
 from lp.services.database import bulk
 from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     quote,
     quote_like,
@@ -289,7 +284,6 @@
         if query is None or an empty string.
         """
         if query:
-            store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
             query = ensure_unicode(query)
             like_query = query.lower()
             like_query = "'%%%%' || %s || '%%%%'" % quote_like(like_query)
@@ -306,10 +300,8 @@
                 '(CASE name WHEN %s THEN 1 '
                 ' ELSE rank(fti, ftq(%s)) END) DESC, displayname, name'
                 % (fti_query, fti_query))
-            result = store.find(self._table, where_clause)
-            result.order_by(order_by)
-            result.config(limit=100)
-            return result
+            return IStore(Product).find(self._table, where_clause).order_by(
+                order_by).config(limit=100)
 
         return self.emptySelectResults()
 
@@ -550,7 +542,7 @@
     @cachedproperty
     def store(self):
         """The storm store."""
-        return getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        return IStore(Product)
 
     @cachedproperty
     def _karma_context_constraint(self):

=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py	2013-05-24 04:48:09 +0000
+++ lib/lp/scripts/garbo.py	2013-06-21 02:35:32 +0000
@@ -80,12 +80,7 @@
     dbify_value,
     )
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    )
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.database.sqlbase import (
     cursor,
     session_store,
@@ -146,8 +141,7 @@
 # provide convenient access to that state data.
 def load_garbo_job_state(job_name):
     # Load the json state data for the given job name.
-    store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
-    job_data = store.execute(
+    job_data = IMasterStore(Person).execute(
         "SELECT json_data FROM GarboJobState WHERE name = ?",
         params=(unicode(job_name),)).get_one()
     if job_data:
@@ -157,7 +151,7 @@
 
 def save_garbo_job_state(job_name, job_data):
     # Save the json state data for the given job name.
-    store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+    store = IMasterStore(Person)
     json_data = simplejson.dumps(job_data, ensure_ascii=False)
     result = store.execute(
         "UPDATE GarboJobState SET json_data = ? WHERE name = ?",
@@ -429,7 +423,7 @@
 
     def __init__(self, log, abort_time=None):
         super(BugSummaryJournalRollup, self).__init__(log, abort_time)
-        self.store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        self.store = IMasterStore(Bug)
 
     def isDone(self):
         has_more = self.store.execute(
@@ -455,7 +449,7 @@
 
     def __init__(self, log, abort_time=None):
         super(VoucherRedeemer, self).__init__(log, abort_time)
-        self.store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        self.store = IMasterStore(CommercialSubscription)
 
     @cachedproperty
     def _salesforce_proxy(self):
@@ -521,7 +515,7 @@
     def __init__(self, log, abort_time=None):
         super_cl = super(PopulateLatestPersonSourcePackageReleaseCache, self)
         super_cl.__init__(log, abort_time)
-        self.store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        self.store = IMasterStore(LatestPersonSourcePackageReleaseCache)
         # Keep a record of the processed source package release id and data
         # type (creator or maintainer) so we know where to job got up to.
         self.last_spph_id = 0
@@ -680,7 +674,7 @@
 
     def __init__(self, log, abort_time=None):
         super(OpenIDConsumerNoncePruner, self).__init__(log, abort_time)
-        self.store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        self.store = IMasterStore(OpenIDConsumerNonce)
         self.earliest_timestamp = self.store.find(
             Min(OpenIDConsumerNonce.timestamp)).one()
         utc_now = int(time.mktime(time.gmtime()))
@@ -716,7 +710,7 @@
 
     def __init__(self, log, abort_time=None):
         super(OpenIDConsumerAssociationPruner, self).__init__(log, abort_time)
-        self.store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        self.store = IMasterStore(OpenIDConsumerNonce)
 
     def __call__(self, chunksize):
         result = self.store.execute("""

=== modified file 'lib/lp/scripts/harness.py'
--- lib/lp/scripts/harness.py	2013-04-26 02:39:48 +0000
+++ lib/lp/scripts/harness.py	2013-06-21 02:35:32 +0000
@@ -40,20 +40,14 @@
 from lp.registry.model.product import Product
 from lp.registry.model.projectgroup import ProjectGroup
 from lp.services.config import dbconfig
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    SLAVE_FLAVOR,
-    )
+from lp.services.database.interfaces import IMasterStore
 from lp.services.scripts import execute_zcml_for_scripts
 from lp.services.webapp import canonical_url
 from lp.testing.factory import LaunchpadObjectFactory
 
 # Silence unused name warnings
 (utc, transaction, verifyObject, removeSecurityProxy, canonical_url,
- SLAVE_FLAVOR, DEFAULT_FLAVOR)
+ getUtility, rlcompleter)
 
 
 def _get_locals():
@@ -69,8 +63,7 @@
     startup = os.environ.get('PYTHONSTARTUP')
     if startup:
         execfile(startup)
-    store_selector = getUtility(IStoreSelector)
-    store = store_selector.get(MAIN_STORE, MASTER_FLAVOR)
+    store = IMasterStore(Person)
 
     if dbuser == 'launchpad':
         # Create a few variables "in case they come in handy."

=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py	2013-05-24 04:48:09 +0000
+++ lib/lp/scripts/tests/test_garbo.py	2013-06-21 02:35:32 +0000
@@ -85,12 +85,7 @@
     THIRTY_DAYS_AGO,
     UTC_NOW,
     )
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    )
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.features.model import FeatureFlag
 from lp.services.identity.interfaces.account import AccountStatus
 from lp.services.identity.interfaces.emailaddress import EmailAddressStatus
@@ -172,7 +167,7 @@
     def setUp(self):
         super(TestBulkPruner, self).setUp()
 
-        self.store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        self.store = IMasterStore(CommercialSubscription)
         self.store.execute("CREATE TABLE BulkFoo (id serial PRIMARY KEY)")
 
         for i in range(10):
@@ -609,7 +604,7 @@
         pruner = OpenIDConsumerAssociationPruner
         table_name = pruner.table_name
         switch_dbuser('testadmin')
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        store = IMasterStore(CommercialSubscription)
         now = time.time()
         # Create some associations in the past with lifetimes
         for delta in range(0, 20):
@@ -632,7 +627,7 @@
         self.runFrequently()
 
         switch_dbuser('testadmin')
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        store = IMasterStore(CommercialSubscription)
         # Confirm all the rows we know should have been expired have
         # been expired. These are the ones that would be expired using
         # the test start time as 'now'.
@@ -669,7 +664,7 @@
         switch_dbuser('testadmin')
         diff_id = removeSecurityProxy(self.factory.makeDiff()).id
         self.runDaily()
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        store = IMasterStore(Diff)
         self.assertContentEqual([], store.find(Diff, Diff.id == diff_id))
 
     def test_RevisionAuthorEmailLinker(self):
@@ -1000,8 +995,7 @@
         template = self.factory.makePOTemplate()
         self.runDaily()
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
-        count, = store.execute("""
+        count, = IMasterStore(CommercialSubscription).execute("""
             SELECT count(*)
             FROM SuggestivePOTemplate
             WHERE potemplate = %s
@@ -1011,7 +1005,7 @@
 
     def test_BugSummaryJournalRollup(self):
         switch_dbuser('testadmin')
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        store = IMasterStore(CommercialSubscription)
 
         # Generate a load of entries in BugSummaryJournal.
         store.execute("UPDATE BugTask SET status=42")
@@ -1031,7 +1025,6 @@
 
     def test_VoucherRedeemer(self):
         switch_dbuser('testadmin')
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
 
         voucher_proxy = TestSalesforceVoucherProxy()
         self.registerUtility(voucher_proxy, ISalesforceVoucherProxy)
@@ -1048,15 +1041,14 @@
         self.runFrequently()
 
         # There should now be 0 pending vouchers in Launchpad.
-        num_rows = store.find(
+        num_rows = IMasterStore(CommercialSubscription).find(
             CommercialSubscription,
             Like(CommercialSubscription.sales_system_id, u'pending-%')
             ).count()
         self.assertThat(num_rows, Equals(0))
         # Salesforce should also now have redeemed the voucher.
         unredeemed_ids = [
-            voucher.voucher_id
-            for voucher in voucher_proxy.getUnredeemedVouchers(mark)]
+            v.voucher_id for v in voucher_proxy.getUnredeemedVouchers(mark)]
         self.assertNotIn(redeemed_id, unredeemed_ids)
 
     def test_UnusedPOTMsgSetPruner_removes_obsolete_message_sets(self):

=== modified file 'lib/lp/security.py'
--- lib/lp/security.py	2013-06-06 06:40:50 +0000
+++ lib/lp/security.py	2013-06-21 02:35:32 +0000
@@ -171,7 +171,7 @@
 from lp.registry.interfaces.wikiname import IWikiName
 from lp.registry.model.person import Person
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.identity.interfaces.account import IAccount
 from lp.services.identity.interfaces.emailaddress import IEmailAddress
 from lp.services.librarian.interfaces import ILibraryFileAliasWithParent

=== modified file 'lib/lp/services/apachelogparser/base.py'
--- lib/lp/services/apachelogparser/base.py	2012-09-28 06:25:44 +0000
+++ lib/lp/services/apachelogparser/base.py	2013-06-21 02:35:32 +0000
@@ -15,11 +15,7 @@
 
 from lp.services.apachelogparser.model.parsedapachelog import ParsedApacheLog
 from lp.services.config import config
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.geoip.interfaces import IGeoIP
 
 
@@ -34,7 +30,7 @@
 
     :param file_paths: The paths to the files.
     """
-    store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+    store = IStore(ParsedApacheLog)
     for file_path in file_paths:
         fd, file_size = get_fd_and_file_size(file_path)
         first_line = unicode(fd.readline())
@@ -179,8 +175,8 @@
 def create_or_update_parsedlog_entry(first_line, parsed_bytes):
     """Create or update the ParsedApacheLog with the given first_line."""
     first_line = unicode(first_line)
-    store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-    parsed_file = store.find(ParsedApacheLog, first_line=first_line).one()
+    parsed_file = IStore(ParsedApacheLog).find(
+        ParsedApacheLog, first_line=first_line).one()
     if parsed_file is None:
         ParsedApacheLog(first_line, parsed_bytes)
     else:

=== modified file 'lib/lp/services/apachelogparser/model/parsedapachelog.py'
--- lib/lp/services/apachelogparser/model/parsedapachelog.py	2012-09-28 06:25:44 +0000
+++ lib/lp/services/apachelogparser/model/parsedapachelog.py	2013-06-21 02:35:32 +0000
@@ -9,7 +9,6 @@
     Storm,
     Unicode,
     )
-from zope.component import getUtility
 from zope.interface import implements
 
 from lp.services.apachelogparser.interfaces.parsedapachelog import (
@@ -17,11 +16,7 @@
     )
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.datetimecol import UtcDateTimeCol
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 
 
 class ParsedApacheLog(Storm):
@@ -39,4 +34,4 @@
         super(ParsedApacheLog, self).__init__()
         self.first_line = unicode(first_line)
         self.bytes_read = bytes_read
-        getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR).add(self)
+        IStore(self.__class__).add(self)

=== modified file 'lib/lp/services/apachelogparser/tests/test_apachelogparser.py'
--- lib/lp/services/apachelogparser/tests/test_apachelogparser.py	2012-09-28 06:25:44 +0000
+++ lib/lp/services/apachelogparser/tests/test_apachelogparser.py	2013-06-21 02:35:32 +0000
@@ -8,8 +8,6 @@
 from StringIO import StringIO
 import tempfile
 
-from zope.component import getUtility
-
 from lp.services.apachelogparser.base import (
     create_or_update_parsedlog_entry,
     get_day,
@@ -21,11 +19,7 @@
     )
 from lp.services.apachelogparser.model.parsedapachelog import ParsedApacheLog
 from lp.services.config import config
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.librarianserver.apachelogparser import DBUSER
 from lp.services.log.logger import BufferLogger
 from lp.testing import TestCase
@@ -477,12 +471,12 @@
         # When given a first_line that doesn't exist in the ParsedApacheLog
         # table, create_or_update_parsedlog_entry() will create a new entry
         # with the given number of bytes read.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         first_line = u'First line'
         create_or_update_parsedlog_entry(
             first_line, parsed_bytes=len(first_line))
 
-        entry = store.find(ParsedApacheLog, first_line=first_line).one()
+        entry = IStore(ParsedApacheLog).find(
+            ParsedApacheLog, first_line=first_line).one()
         self.assertIsNot(None, entry)
         self.assertEqual(entry.bytes_read, len(first_line))
 
@@ -492,7 +486,7 @@
         # with the given number of bytes read.
         first_line = u'First line'
         create_or_update_parsedlog_entry(first_line, parsed_bytes=2)
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(ParsedApacheLog)
         entry = store.find(ParsedApacheLog, first_line=first_line).one()
 
         # Here we see that the new entry was created.

=== modified file 'lib/lp/services/database/bulk.py'
--- lib/lp/services/database/bulk.py	2012-11-14 06:32:55 +0000
+++ lib/lp/services/database/bulk.py	2013-06-21 02:35:32 +0000
@@ -37,7 +37,7 @@
 from storm.store import Store
 from zope.security.proxy import removeSecurityProxy
 
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 
 
 def collate(things, key):

=== modified file 'lib/lp/services/database/collection.py'
--- lib/lp/services/database/collection.py	2012-09-28 06:25:44 +0000
+++ lib/lp/services/database/collection.py	2013-06-21 02:35:32 +0000
@@ -12,13 +12,8 @@
     Join,
     LeftJoin,
     )
-from zope.component import getUtility
 
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 
 
 class Collection(object):
@@ -74,8 +69,8 @@
 
         self.store = kwargs.get('store')
         if self.store is None:
-            self.store = getUtility(IStoreSelector).get(
-                MAIN_STORE, DEFAULT_FLAVOR)
+            from lp.services.librarian.model import LibraryFileAlias
+            self.store = IStore(LibraryFileAlias)
 
         self.tables = (
             starting_tables + base_tables +

=== modified file 'lib/lp/services/database/doc/db-policy.txt'
--- lib/lp/services/database/doc/db-policy.txt	2012-09-28 06:34:26 +0000
+++ lib/lp/services/database/doc/db-policy.txt	2013-06-21 02:35:32 +0000
@@ -12,7 +12,7 @@
 information, you retrieve objects from the master databases that stores
 the data for your database class.
 
-    >>> from lp.services.database.lpstorm import IMasterStore
+    >>> from lp.services.database.interfaces import IMasterStore
     >>> from lp.registry.model.person import Person
     >>> import transaction
 
@@ -31,7 +31,7 @@
 We can distribute this load over many slave databases but are limited to
 a single master.
 
-    >>> from lp.services.database.lpstorm import ISlaveStore
+    >>> from lp.services.database.interfaces import ISlaveStore
     >>> ro_janitor = ISlaveStore(Person).find(
     ...     Person, Person.name == 'janitor').one()
     >>> ro_janitor is writable_janitor
@@ -50,7 +50,7 @@
 retrieve objects from the default store. What object being returned
 depends on the currently installed database policy.
 
-    >>> from lp.services.database.lpstorm import IStore
+    >>> from lp.services.database.interfaces import IStore
     >>> default_janitor = IStore(Person).find(
     ...     Person, Person.name == 'janitor').one()
     >>> default_janitor is writable_janitor
@@ -120,6 +120,6 @@
 to a writable copy. This is a noop if the object is already writable
 so is good defensive programming.
 
-    >>> from lp.services.database.lpstorm import IMasterObject
+    >>> from lp.services.database.interfaces import IMasterObject
     >>> IMasterObject(ro_janitor) is writable_janitor
     True

=== modified file 'lib/lp/services/database/doc/storm-store-reset.txt'
--- lib/lp/services/database/doc/storm-store-reset.txt	2012-09-28 06:34:26 +0000
+++ lib/lp/services/database/doc/storm-store-reset.txt	2013-06-21 02:35:32 +0000
@@ -14,8 +14,8 @@
 we rely on that to find out whether or not to reset stores.
 
     >>> import threading
-    >>> from lp.services.database.interfaces import (
-    ...     IStoreSelector, MAIN_STORE, DEFAULT_FLAVOR)
+    >>> from lp.registry.model.person import Person
+    >>> from lp.services.database.interfaces import IStore
     >>> from lp.testing.pages import UnstickyCookieHTTPCaller
     >>> logout()
     >>> alive_items = None
@@ -30,8 +30,7 @@
     ...     http.getControl("Display Name").value = "Changed"
     ...     # Need a POST or the DB policy will be using the slave.
     ...     http.getControl("Save Changes").click()
-    ...     alive_items = len(getUtility(IStoreSelector).get(
-    ...         MAIN_STORE, DEFAULT_FLAVOR)._alive)
+    ...     alive_items = len(IStore(Person)._alive)
 
     >>> request_salgados_homepage()
     >>> print thread_name

=== modified file 'lib/lp/services/database/doc/storm.txt'
--- lib/lp/services/database/doc/storm.txt	2012-02-02 10:28:24 +0000
+++ lib/lp/services/database/doc/storm.txt	2013-06-21 02:35:32 +0000
@@ -10,7 +10,7 @@
     ...     EmailAddressStatus,
     ...     IEmailAddressSet,
     ...     )
-    >>> from lp.services.database.lpstorm import (
+    >>> from lp.services.database.interfaces import (
     ...     IMasterObject,
     ...     IMasterStore,
     ...     ISlaveStore,

=== modified file 'lib/lp/services/database/interfaces.py'
--- lib/lp/services/database/interfaces.py	2012-09-28 06:04:31 +0000
+++ lib/lp/services/database/interfaces.py	2013-06-21 02:35:32 +0000
@@ -1,6 +1,25 @@
 # Copyright 2009 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
+__metaclass__ = type
+__all__ = [
+    'DEFAULT_FLAVOR',
+    'DisallowedStore',
+    'IDatabasePolicy',
+    'IDBObject',
+    'IMasterObject',
+    'IMasterStore',
+    'IRequestExpired',
+    'ISlaveStore',
+    'ISQLBase',
+    'IStore',
+    'IStoreSelector',
+    'MAIN_STORE',
+    'MASTER_FLAVOR',
+    'SLAVE_FLAVOR',
+    ]
+
+
 from zope.interface import Interface
 from zope.interface.common.interfaces import IRuntimeError
 from zope.schema import Int
@@ -127,3 +146,25 @@
 
         :raises DisallowedStore:
         """
+
+
+class IStore(Interface):
+    """A storm.store.Store."""
+    def get(cls, key):
+        """See storm.store.Store."""
+
+
+class IMasterStore(IStore):
+    """A writeable Storm Stores."""
+
+
+class ISlaveStore(IStore):
+    """A read-only Storm Store."""
+
+
+class IDBObject(Interface):
+    """A Storm database object."""
+
+
+class IMasterObject(IDBObject):
+    """A Storm database object associated with its master Store."""

=== removed file 'lib/lp/services/database/lpstorm.py'
--- lib/lp/services/database/lpstorm.py	2011-12-21 14:58:31 +0000
+++ lib/lp/services/database/lpstorm.py	1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Storm marker interfaces."""
-
-__metaclass__ = type
-__all__ = [
-    'IDBObject', 'IMasterObject', 'IMasterStore', 'ISlaveStore', 'IStore',
-    ]
-
-
-from zope.interface import Interface
-
-
-class IStore(Interface):
-    """A storm.store.Store."""
-    def get(cls, key):
-        """See storm.store.Store."""
-
-
-class IMasterStore(IStore):
-    """A writeable Storm Stores."""
-
-
-class ISlaveStore(IStore):
-    """A read-only Storm Store."""
-
-
-class IDBObject(Interface):
-    """A Storm database object."""
-
-
-class IMasterObject(IDBObject):
-    """A Storm database object associated with its master Store."""

=== modified file 'lib/lp/services/database/policy.py'
--- lib/lp/services/database/policy.py	2013-04-09 09:47:58 +0000
+++ lib/lp/services/database/policy.py	2013-06-21 02:35:32 +0000
@@ -44,15 +44,13 @@
     DEFAULT_FLAVOR,
     DisallowedStore,
     IDatabasePolicy,
+    IMasterStore,
+    ISlaveStore,
     IStoreSelector,
     MAIN_STORE,
     MASTER_FLAVOR,
     SLAVE_FLAVOR,
     )
-from lp.services.database.lpstorm import (
-    IMasterStore,
-    ISlaveStore,
-    )
 from lp.services.database.sqlbase import StupidCache
 
 

=== modified file 'lib/lp/services/database/sqlbase.py'
--- lib/lp/services/database/sqlbase.py	2012-09-28 06:47:16 +0000
+++ lib/lp/services/database/sqlbase.py	2013-06-21 02:35:32 +0000
@@ -59,15 +59,13 @@
 from lp.services.database.interfaces import (
     DEFAULT_FLAVOR,
     DisallowedStore,
+    IMasterObject,
+    IMasterStore,
     ISQLBase,
     IStoreSelector,
+    IStore,
     MAIN_STORE,
     )
-from lp.services.database.lpstorm import (
-    IMasterObject,
-    IMasterStore,
-    IStore,
-    )
 from lp.services.propertycache import clear_property_cache
 
 # Default we want for scripts, and the PostgreSQL default. Note psycopg1 will

=== modified file 'lib/lp/services/database/tests/test_bulk.py'
--- lib/lp/services/database/tests/test_bulk.py	2012-10-17 00:22:31 +0000
+++ lib/lp/services/database/tests/test_bulk.py	2013-06-21 02:35:32 +0000
@@ -30,7 +30,7 @@
 from lp.code.model.branchsubscription import BranchSubscription
 from lp.registry.model.person import Person
 from lp.services.database import bulk
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     ISlaveStore,
     IStore,

=== modified file 'lib/lp/services/database/tests/test_collection.py'
--- lib/lp/services/database/tests/test_collection.py	2012-09-28 06:25:44 +0000
+++ lib/lp/services/database/tests/test_collection.py	2013-06-21 02:35:32 +0000
@@ -9,23 +9,15 @@
     Int,
     Storm,
     )
-from zope.component import getUtility
 
+from lp.registry.model.person import Person
 from lp.services.database.collection import Collection
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    )
+from lp.services.database.interfaces import IStore
 from lp.testing import TestCaseWithFactory
 from lp.testing.fakemethod import FakeMethod
 from lp.testing.layers import ZopelessDatabaseLayer
 
 
-def get_store():
-    return getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
-
-
 class FakeStore:
     find = FakeMethod(result=[])
 
@@ -38,7 +30,7 @@
     assert range_start < range_end, "Invalid range."
     if table_name is None:
         table_name = "TestTable"
-    get_store().execute("""
+    IStore(Person).execute("""
        CREATE TEMP TABLE %s AS
        SELECT generate_series AS id
        FROM generate_series(%d, %d)
@@ -69,7 +61,7 @@
 
     def test_make_table(self):
         TestTable = make_table(1, 5)
-        result = get_store().find(TestTable).order_by(TestTable.id)
+        result = IStore(Person).find(TestTable).order_by(TestTable.id)
         self.assertEqual(range(1, 5), get_ids(result))
 
     def test_select_one(self):

=== modified file 'lib/lp/services/database/tests/test_transaction_decorators.py'
--- lib/lp/services/database/tests/test_transaction_decorators.py	2013-06-14 07:16:46 +0000
+++ lib/lp/services/database/tests/test_transaction_decorators.py	2013-06-21 02:35:32 +0000
@@ -4,17 +4,12 @@
 import unittest
 
 import transaction
-from zope.component import getUtility
 
 from lp.services.database import (
     read_transaction,
     write_transaction,
     )
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.librarian.model import LibraryFileContent
 from lp.services.librarianserver import db
 from lp.testing.dbuser import switch_dbuser
@@ -28,8 +23,7 @@
 
     def setUp(self):
         switch_dbuser('librarian')
-        self.store = getUtility(IStoreSelector).get(
-                MAIN_STORE, DEFAULT_FLAVOR)
+        self.store = IStore(LibraryFileContent)
         self.content_id = db.Library().add('deadbeef', 1234, 'abababab', 'ba')
         self.file_content = self._getTestFileContent()
         transaction.commit()

=== modified file 'lib/lp/services/database/tests/test_transaction_policy.py'
--- lib/lp/services/database/tests/test_transaction_policy.py	2012-01-11 08:52:22 +0000
+++ lib/lp/services/database/tests/test_transaction_policy.py	2013-06-21 02:35:32 +0000
@@ -9,11 +9,11 @@
 import transaction
 
 from lp.registry.model.person import Person
+from lp.services.database.interfaces import IStore
 from lp.services.database.isolation import (
     check_no_transaction,
     TransactionInProgress,
     )
-from lp.services.database.lpstorm import IStore
 from lp.services.database.transaction_policy import DatabaseTransactionPolicy
 from lp.testing import TestCaseWithFactory
 from lp.testing.layers import ZopelessDatabaseLayer

=== modified file 'lib/lp/services/database/transaction_policy.py'
--- lib/lp/services/database/transaction_policy.py	2012-09-28 06:25:44 +0000
+++ lib/lp/services/database/transaction_policy.py	2013-06-21 02:35:32 +0000
@@ -10,13 +10,9 @@
 
 from psycopg2.extensions import TRANSACTION_STATUS_IDLE
 import transaction
-from zope.component import getUtility
 
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    )
+from lp.registry.model.person import Person
+from lp.services.database.interfaces import IMasterStore
 from lp.services.database.isolation import TransactionInProgress
 from lp.services.database.sqlbase import quote
 
@@ -79,8 +75,7 @@
         """
         self.read_only = read_only
         if store is None:
-            self.store = getUtility(IStoreSelector).get(
-                MAIN_STORE, MASTER_FLAVOR)
+            self.store = IMasterStore(Person)
         else:
             self.store = store
 

=== modified file 'lib/lp/services/doc/collection.txt'
--- lib/lp/services/doc/collection.txt	2012-09-28 06:34:26 +0000
+++ lib/lp/services/doc/collection.txt	2013-06-21 02:35:32 +0000
@@ -14,10 +14,10 @@
 them.
 
     >>> from storm.locals import Count, Int, Storm
-    >>> from lp.services.database.interfaces import (
-    ...     IStoreSelector, MAIN_STORE, MASTER_FLAVOR)
+    >>> from lp.registry.model.product import Product
+    >>> from lp.services.database.interfaces import IMasterStore
 
-    >>> store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+    >>> store = IMasterStore(Product)
     >>> ok = store.execute("CREATE TEMP TABLE Kumquat(id integer UNIQUE)")
     >>> class Kumquat(Storm):
     ...     __storm_table__ = 'Kumquat'

=== modified file 'lib/lp/services/features/model.py'
--- lib/lp/services/features/model.py	2012-09-28 06:25:44 +0000
+++ lib/lp/services/features/model.py	2013-06-21 02:35:32 +0000
@@ -19,21 +19,9 @@
     Storm,
     Unicode,
     )
-from zope.component import getUtility
 
 from lp.services.database.datetimecol import UtcDateTimeCol
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-
-
-def getFeatureStore():
-    """Get Storm store to access feature definitions."""
-    # TODO: This is copied so many times in Launchpad; maybe it should be more
-    # general?
-    return getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+from lp.services.database.interfaces import IStore
 
 
 class FeatureFlag(Storm):
@@ -74,3 +62,10 @@
         self.date_changed = datetime.now(pytz.timezone('UTC'))
         self.comment = unicode(comment)
         self.person = person
+
+
+def getFeatureStore():
+    """Get Storm store to access feature definitions."""
+    # TODO: This is copied so many times in Launchpad; maybe it should be more
+    # general?
+    return IStore(FeatureFlag)

=== modified file 'lib/lp/services/feeds/stories/xx-security.txt'
--- lib/lp/services/feeds/stories/xx-security.txt	2012-09-18 19:41:02 +0000
+++ lib/lp/services/feeds/stories/xx-security.txt	2013-06-21 02:35:32 +0000
@@ -6,7 +6,7 @@
 
     >>> from zope.security.interfaces import Unauthorized
     >>> from BeautifulSoup import BeautifulStoneSoup as BSS
-    >>> from lp.services.database.lpstorm import IStore
+    >>> from lp.services.database.interfaces import IStore
     >>> import transaction
     >>> from lp.bugs.model.bug import Bug
     >>> from lp.app.enums import InformationType

=== modified file 'lib/lp/services/fields/tests/test_fields.py'
--- lib/lp/services/fields/tests/test_fields.py	2012-08-13 21:04:17 +0000
+++ lib/lp/services/fields/tests/test_fields.py	2013-06-21 02:35:32 +0000
@@ -20,7 +20,7 @@
     INCLUSIVE_TEAM_POLICY,
     )
 from lp.registry.interfaces.nameblacklist import INameBlacklistSet
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.fields import (
     BaseImageUpload,
     BlacklistableContentNameField,

=== modified file 'lib/lp/services/identity/model/account.py'
--- lib/lp/services/identity/model/account.py	2012-12-04 23:22:41 +0000
+++ lib/lp/services/identity/model/account.py	2013-06-21 02:35:32 +0000
@@ -16,7 +16,7 @@
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/services/job/celeryjob.py'
--- lib/lp/services/job/celeryjob.py	2013-06-04 05:50:28 +0000
+++ lib/lp/services/job/celeryjob.py	2013-06-21 02:35:32 +0000
@@ -29,7 +29,7 @@
 from lp.code.model.branchjob import BranchScanJob
 from lp.scripts.helpers import TransactionFreeOperation
 from lp.services.config import dbconfig
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.features import (
     install_feature_controller,
     make_script_feature_controller,

=== modified file 'lib/lp/services/job/model/job.py'
--- lib/lp/services/job/model/job.py	2013-06-14 01:25:49 +0000
+++ lib/lp/services/job/model/job.py	2013-06-21 02:35:32 +0000
@@ -39,7 +39,7 @@
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import SQLBase
 from lp.services.job.interfaces.job import (
     IJob,

=== modified file 'lib/lp/services/job/tests/test_job.py'
--- lib/lp/services/job/tests/test_job.py	2012-12-26 01:32:19 +0000
+++ lib/lp/services/job/tests/test_job.py	2013-06-21 02:35:32 +0000
@@ -14,7 +14,7 @@
 
 from lp.code.model.branchmergeproposaljob import CodeReviewCommentEmailJob
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.job.interfaces.job import (
     IJob,
     JobStatus,

=== modified file 'lib/lp/services/job/tests/test_retry_jobs_with_celery.py'
--- lib/lp/services/job/tests/test_retry_jobs_with_celery.py	2012-06-14 05:18:22 +0000
+++ lib/lp/services/job/tests/test_retry_jobs_with_celery.py	2013-06-21 02:35:32 +0000
@@ -12,7 +12,7 @@
 from zope.interface import implements
 
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.features.testing import FeatureFixture
 from lp.services.job.interfaces.job import (
     IJob,

=== modified file 'lib/lp/services/librarian/client.py'
--- lib/lp/services/librarian/client.py	2013-06-13 07:31:30 +0000
+++ lib/lp/services/librarian/client.py	2013-06-21 02:35:32 +0000
@@ -32,18 +32,13 @@
 
 from lazr.restful.utils import get_current_browser_request
 from storm.store import Store
-from zope.component import getUtility
 from zope.interface import implements
 
 from lp.services.config import (
     config,
     dbconfig,
     )
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    )
+from lp.services.database.interfaces import IMasterStore
 from lp.services.database.postgresql import ConnectionString
 from lp.services.librarian.interfaces.client import (
     DownloadFailed,
@@ -155,7 +150,7 @@
             # Get the name of the database the client is using, so that
             # the server can check that the client is using the same
             # database as the server.
-            store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+            store = IMasterStore(LibraryFileAlias)
             databaseName = self._getDatabaseName(store)
 
             # Generate new content and alias IDs.

=== modified file 'lib/lp/services/librarian/doc/librarian.txt'
--- lib/lp/services/librarian/doc/librarian.txt	2012-09-28 06:34:26 +0000
+++ lib/lp/services/librarian/doc/librarian.txt	2013-06-21 02:35:32 +0000
@@ -581,13 +581,11 @@
     # record. Such records are considered as being deleted.
 
     >>> from lp.services.librarian.model import LibraryFileAlias
-    >>> from lp.services.database.interfaces import (
-    ...     IStoreSelector, MAIN_STORE, MASTER_FLAVOR)
+    >>> from lp.services.database.interfaces import IMasterStore
 
-    >>> store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
     >>> deleted_file = LibraryFileAlias(
     ...     content=None, filename='deleted.txt', mimetype='text/plain')
-    >>> ignore = store.add(deleted_file)
+    >>> ignore = IMasterStore(LibraryFileAlias).add(deleted_file)
 
 Commit the just-created files.
 

=== modified file 'lib/lp/services/librarian/model.py'
--- lib/lp/services/librarian/model.py	2013-06-13 07:31:30 +0000
+++ lib/lp/services/librarian/model.py	2013-06-21 02:35:32 +0000
@@ -49,7 +49,7 @@
     UTC_NOW,
     )
 from lp.services.database.datetimecol import UtcDateTimeCol
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.database.sqlbase import (
     session_store,
     SQLBase,

=== modified file 'lib/lp/services/librarian/tests/test_client.py'
--- lib/lp/services/librarian/tests/test_client.py	2013-06-13 07:31:30 +0000
+++ lib/lp/services/librarian/tests/test_client.py	2013-06-21 02:35:32 +0000
@@ -14,7 +14,7 @@
 import transaction
 
 from lp.services.config import config
-from lp.services.database.lpstorm import ISlaveStore
+from lp.services.database.interfaces import ISlaveStore
 from lp.services.database.policy import SlaveDatabasePolicy
 from lp.services.database.sqlbase import block_implicit_flushes
 from lp.services.librarian import client as client_module

=== modified file 'lib/lp/services/librarianserver/db.py'
--- lib/lp/services/librarianserver/db.py	2013-06-13 07:31:30 +0000
+++ lib/lp/services/librarianserver/db.py	2013-06-21 02:35:32 +0000
@@ -13,7 +13,7 @@
     SQL,
     )
 
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import session_store
 from lp.services.librarian.model import (
     LibraryFileAlias,
@@ -48,9 +48,9 @@
         :param token: The token for the file. If None no token is present.
             When a token is supplied, it is looked up with path.
         :param path: The path the request is for, unused unless a token
-            is supplied; when supplied it must match the token. The 
+            is supplied; when supplied it must match the token. The
             value of path is expected to be that from a twisted request.args
-            e.g. /foo/bar. 
+            e.g. /foo/bar.
         """
         restricted = self.restricted
         if token and path:
@@ -59,7 +59,7 @@
             store = session_store()
             token_found = store.find(TimeLimitedToken,
                 SQL("age(created) < interval '1 day'"),
-                TimeLimitedToken.token==token,
+                TimeLimitedToken.token == token,
                 TimeLimitedToken.path==path).is_empty()
             store.reset()
             if token_found:
@@ -94,7 +94,6 @@
 
         If a matching alias already exists, it will return that ID instead.
         """
-        return LibraryFileAlias(contentID=fileid, filename=filename,
-                                mimetype=mimetype, expires=expires,
-                                restricted=self.restricted).id
-
+        return LibraryFileAlias(
+            contentID=fileid, filename=filename, mimetype=mimetype,
+            expires=expires, restricted=self.restricted).id

=== modified file 'lib/lp/services/librarianserver/storage.py'
--- lib/lp/services/librarianserver/storage.py	2013-06-13 07:31:30 +0000
+++ lib/lp/services/librarianserver/storage.py	2013-06-21 02:35:32 +0000
@@ -9,15 +9,10 @@
 import shutil
 import tempfile
 
-from zope.component import getUtility
-
+from lp.registry.model.product import Product
 from lp.services.config import dbconfig
 from lp.services.database import write_transaction
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.postgresql import ConnectionString
 
 
@@ -139,9 +134,7 @@
                 config_dbname = ConnectionString(
                     dbconfig.rw_main_master).dbname
 
-                store = getUtility(IStoreSelector).get(
-                        MAIN_STORE, DEFAULT_FLAVOR)
-                result = store.execute("SELECT current_database()")
+                result = IStore(Product).execute("SELECT current_database()")
                 real_dbname = result.get_one()[0]
                 if self.databaseName not in (config_dbname, real_dbname):
                     raise WrongDatabaseError(

=== modified file 'lib/lp/services/librarianserver/tests/test_db.py'
--- lib/lp/services/librarianserver/tests/test_db.py	2013-06-13 07:31:30 +0000
+++ lib/lp/services/librarianserver/tests/test_db.py	2013-06-21 02:35:32 +0000
@@ -4,13 +4,8 @@
 import unittest
 
 import transaction
-from zope.component import getUtility
 
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.librarian.model import LibraryFileContent
 from lp.services.librarianserver import db
 from lp.testing.dbuser import switch_dbuser
@@ -55,8 +50,7 @@
 
     def setUp(self):
         switch_dbuser('librarian')
-        self.store = getUtility(IStoreSelector).get(
-                MAIN_STORE, DEFAULT_FLAVOR)
+        self.store = IStore(LibraryFileContent)
         self.content_id = db.Library().add('deadbeef', 1234, 'abababab', 'ba')
         self.file_content = self._getTestFileContent()
         transaction.commit()

=== modified file 'lib/lp/services/librarianserver/tests/test_storage.py'
--- lib/lp/services/librarianserver/tests/test_storage.py	2013-06-13 07:31:30 +0000
+++ lib/lp/services/librarianserver/tests/test_storage.py	2013-06-21 02:35:32 +0000
@@ -7,13 +7,7 @@
 import tempfile
 import unittest
 
-from zope.component import getUtility
-
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.librarian.model import LibraryFileContent
 from lp.services.librarianserver import db
 from lp.services.librarianserver.storage import (
@@ -33,8 +27,7 @@
         self.storage = LibrarianStorage(self.directory, db.Library())
 
         # Hook the commit and rollback methods of the store.
-        self.store = getUtility(IStoreSelector).get(
-                MAIN_STORE, DEFAULT_FLAVOR)
+        self.store = IStore(LibraryFileContent)
         self.committed = self.rolledback = False
         self.orig_commit = self.store.commit
         self.orig_rollback = self.store.rollback

=== modified file 'lib/lp/services/librarianserver/tests/test_web.py'
--- lib/lp/services/librarianserver/tests/test_web.py	2012-12-20 07:44:56 +0000
+++ lib/lp/services/librarianserver/tests/test_web.py	2013-06-21 02:35:32 +0000
@@ -18,7 +18,7 @@
 from zope.component import getUtility
 
 from lp.services.config import config
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.database.sqlbase import (
     cursor,
     flush_database_updates,

=== modified file 'lib/lp/services/looptuner.py'
--- lib/lp/services/looptuner.py	2013-03-21 05:00:52 +0000
+++ lib/lp/services/looptuner.py	2013-06-21 02:35:32 +0000
@@ -16,17 +16,12 @@
 import time
 
 import transaction
-from zope.component import getUtility
 from zope.interface import (
     implements,
     Interface,
     )
 
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    )
+from lp.services.database.interfaces import IMasterStore
 import lp.services.scripts
 
 
@@ -288,7 +283,8 @@
     def _blockWhenLagged(self):
         """When database replication lag is high, block until it drops."""
         # Lag is most meaningful on the master.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        from lp.services.librarian.model import LibraryFileAlias
+        store = IMasterStore(LibraryFileAlias)
         msg_counter = 0
         while not self._isTimedOut():
             lag = store.execute("SELECT replication_lag()").get_one()[0]
@@ -311,7 +307,8 @@
         bloat worse."""
         if self.long_running_transaction is None:
             return
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        from lp.services.librarian.model import LibraryFileAlias
+        store = IMasterStore(LibraryFileAlias)
         msg_counter = 0
         while not self._isTimedOut():
             results = list(store.execute("""

=== modified file 'lib/lp/services/mailman/tests/test_mlist_sync.py'
--- lib/lp/services/mailman/tests/test_mlist_sync.py	2013-01-03 17:42:59 +0000
+++ lib/lp/services/mailman/tests/test_mlist_sync.py	2013-06-21 02:35:32 +0000
@@ -20,7 +20,7 @@
 from transaction import commit
 
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.identity.model.emailaddress import EmailAddressSet
 from lp.services.mailman.tests import MailmanTestCase
 from lp.testing import person_logged_in

=== modified file 'lib/lp/services/oauth/model.py'
--- lib/lp/services/oauth/model.py	2012-10-03 06:32:48 +0000
+++ lib/lp/services/oauth/model.py	2013-06-21 02:35:32 +0000
@@ -29,7 +29,6 @@
     Int,
     Reference,
     )
-from zope.component import getUtility
 from zope.interface import implements
 
 from lp.registry.interfaces.distribution import IDistribution
@@ -41,13 +40,10 @@
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    )
+from lp.services.database.interfaces import IMasterStore
 from lp.services.database.sqlbase import SQLBase
 from lp.services.database.stormbase import StormBase
+from lp.services.librarian.model import LibraryFileAlias
 from lp.services.oauth.interfaces import (
     ClockSkew,
     IOAuthAccessToken,
@@ -104,7 +100,7 @@
         authorization exchange, since it will be done across applications that
         won't share the session cookies.
         """
-        return getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        return IMasterStore(LibraryFileAlias)
 
     getStore = _get_store
 

=== modified file 'lib/lp/services/openid/adapters/openid.py'
--- lib/lp/services/openid/adapters/openid.py	2012-04-16 23:02:44 +0000
+++ lib/lp/services/openid/adapters/openid.py	2013-06-21 02:35:32 +0000
@@ -20,7 +20,7 @@
     )
 
 from lp.registry.interfaces.person import IPerson
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.identity.interfaces.account import IAccount
 from lp.services.openid.interfaces.openid import IOpenIDPersistentIdentity
 from lp.services.openid.model.openididentifier import OpenIdIdentifier

=== modified file 'lib/lp/services/openid/model/baseopenidstore.py'
--- lib/lp/services/openid/model/baseopenidstore.py	2011-12-21 14:58:31 +0000
+++ lib/lp/services/openid/model/baseopenidstore.py	2013-06-21 02:35:32 +0000
@@ -22,7 +22,7 @@
     Unicode,
     )
 
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 
 
 class BaseStormOpenIDAssociation:

=== modified file 'lib/lp/services/openid/tests/test_baseopenidstore.py'
--- lib/lp/services/openid/tests/test_baseopenidstore.py	2012-04-16 23:02:44 +0000
+++ lib/lp/services/openid/tests/test_baseopenidstore.py	2013-06-21 02:35:32 +0000
@@ -14,7 +14,7 @@
 from openid.association import Association
 from openid.store import nonce
 
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.openid.model.baseopenidstore import BaseStormOpenIDStore
 
 

=== modified file 'lib/lp/services/session/adapters.py'
--- lib/lp/services/session/adapters.py	2011-12-30 06:14:56 +0000
+++ lib/lp/services/session/adapters.py	2013-06-21 02:35:32 +0000
@@ -10,7 +10,7 @@
 from zope.component import adapter
 from zope.interface import implementer
 
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     ISlaveStore,
     IStore,

=== modified file 'lib/lp/services/session/tests/test_session.py'
--- lib/lp/services/session/tests/test_session.py	2012-01-01 02:58:52 +0000
+++ lib/lp/services/session/tests/test_session.py	2013-06-21 02:35:32 +0000
@@ -5,7 +5,7 @@
 
 __metaclass__ = type
 
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     ISlaveStore,
     IStore,

=== modified file 'lib/lp/services/tokens.py'
--- lib/lp/services/tokens.py	2012-04-16 23:02:44 +0000
+++ lib/lp/services/tokens.py	2013-06-21 02:35:32 +0000
@@ -12,7 +12,7 @@
 
 import random
 
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 
 
 def create_token(token_length):

=== modified file 'lib/lp/services/verification/model/logintoken.py'
--- lib/lp/services/verification/model/logintoken.py	2013-01-10 06:04:00 +0000
+++ lib/lp/services/verification/model/logintoken.py	2013-06-21 02:35:32 +0000
@@ -25,11 +25,7 @@
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    )
+from lp.services.database.interfaces import IMasterStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,
@@ -286,8 +282,7 @@
 
         # It's important to always use the MASTER_FLAVOR store here
         # because we don't want replication lag to cause a 404 error.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
-        return store.find(LoginToken, conditions)
+        return IMasterStore(LoginToken).find(LoginToken, conditions)
 
     def deleteByEmailRequesterAndType(self, email, requester, type):
         """See ILoginTokenSet."""
@@ -314,8 +309,7 @@
 
         # It's important to always use the MASTER_FLAVOR store here
         # because we don't want replication lag to cause a 404 error.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
-        return store.find(LoginToken, conditions)
+        return IMasterStore(LoginToken).find(LoginToken, conditions)
 
     def getPendingGPGKeys(self, requesterid=None):
         """See ILoginTokenSet."""

=== modified file 'lib/lp/services/webapp/adapter.py'
--- lib/lp/services/webapp/adapter.py	2013-01-07 03:29:28 +0000
+++ lib/lp/services/webapp/adapter.py	2013-06-21 02:35:32 +0000
@@ -54,16 +54,14 @@
     )
 from lp.services.database.interfaces import (
     DEFAULT_FLAVOR,
+    IMasterObject,
+    IMasterStore,
     IRequestExpired,
     IStoreSelector,
     MAIN_STORE,
     MASTER_FLAVOR,
     SLAVE_FLAVOR,
     )
-from lp.services.database.lpstorm import (
-    IMasterObject,
-    IMasterStore,
-    )
 from lp.services.database.policy import MasterDatabasePolicy
 from lp.services.database.postgresql import ConnectionString
 from lp.services.log.loglevels import DEBUG2

=== modified file 'lib/lp/services/webapp/batching.py'
--- lib/lp/services/webapp/batching.py	2012-09-28 06:25:44 +0000
+++ lib/lp/services/webapp/batching.py	2013-06-21 02:35:32 +0000
@@ -25,10 +25,7 @@
 from storm.properties import PropertyColumn
 from storm.store import EmptyResultSet
 from storm.zope.interfaces import IResultSet
-from zope.component import (
-    adapts,
-    getUtility,
-    )
+from zope.component import adapts
 from zope.interface import implements
 from zope.interface.common.sequence import IFiniteSequence
 from zope.security.proxy import (
@@ -39,11 +36,7 @@
 
 from lp.services.config import config
 from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    SLAVE_FLAVOR,
-    )
+from lp.services.database.interfaces import ISlaveStore
 from lp.services.database.sqlbase import (
     convert_storm_clause_to_string,
     sqlvalues,
@@ -591,6 +584,7 @@
     @cachedproperty
     def rough_length(self):
         """See `IRangeFactory."""
+        from lp.services.librarian.model import LibraryFileAlias
         # get_select_expr() requires at least one column as a parameter.
         # getorderBy() already knows about columns that can appear
         # in the result set, so let's use them. Moreover, for SELECT
@@ -602,8 +596,7 @@
         select = removeSecurityProxy(self.plain_resultset).get_select_expr(
             *columns)
         explain = 'EXPLAIN ' + convert_storm_clause_to_string(select)
-        store = getUtility(IStoreSelector).get(MAIN_STORE, SLAVE_FLAVOR)
-        result = store.execute(explain)
+        result = ISlaveStore(LibraryFileAlias).execute(explain)
         _rows_re = re.compile("rows=(\d+)\swidth=")
         first_line = result.get_one()[0]
         match = _rows_re.search(first_line)

=== modified file 'lib/lp/services/webapp/configure.zcml'
--- lib/lp/services/webapp/configure.zcml	2013-06-03 07:10:04 +0000
+++ lib/lp/services/webapp/configure.zcml	2013-06-21 02:35:32 +0000
@@ -193,17 +193,17 @@
          to the correct Store for that tables replication set.
       -->
     <adapter
-        provides="lp.services.database.lpstorm.IStore"
+        provides="lp.services.database.interfaces.IStore"
         for="zope.interface.Interface"
         factory="lp.services.webapp.adapter.get_store"
         />
     <adapter
-        provides="lp.services.database.lpstorm.IMasterStore"
+        provides="lp.services.database.interfaces.IMasterStore"
         for="zope.interface.Interface"
         factory="lp.services.webapp.adapter.get_master_store"
         />
     <adapter
-        provides="lp.services.database.lpstorm.ISlaveStore"
+        provides="lp.services.database.interfaces.ISlaveStore"
         for="zope.interface.Interface"
         factory="lp.services.webapp.adapter.get_slave_store"
         />
@@ -211,17 +211,17 @@
          We have no way of specifying that all subclasses of
          storm.locals.Storm implement an Interface. -->
     <adapter
-        provides="lp.services.database.lpstorm.IMasterObject"
+        provides="lp.services.database.interfaces.IMasterObject"
         for="zope.interface.Interface"
         trusted="yes"
         factory="lp.services.webapp.adapter.get_object_from_master_store"
         />
     <class class="storm.store.Store">
-        <implements interface="lp.services.database.lpstorm.IStore" />
+        <implements interface="lp.services.database.interfaces.IStore" />
         <allow attributes="get" />
     </class>
     <class class="lp.services.database.sqlbase.SQLBase">
-        <implements interface="lp.services.database.lpstorm.IDBObject" />
+        <implements interface="lp.services.database.interfaces.IDBObject" />
     </class>
 
     <!-- Default favicon -->

=== modified file 'lib/lp/services/webapp/doc/test_adapter.txt'
--- lib/lp/services/webapp/doc/test_adapter.txt	2012-11-14 09:27:39 +0000
+++ lib/lp/services/webapp/doc/test_adapter.txt	2013-06-21 02:35:32 +0000
@@ -172,8 +172,7 @@
     ...     zstorm.remove(store)
     ...     transaction.abort()
     ...     store.close()
-    ...     store = getUtility(IStoreSelector).get(
-    ...         MAIN_STORE, MASTER_FLAVOR)
+    ...     store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
 
     >>> set_request_started()
     >>> print current_statement_timeout(store)

=== modified file 'lib/lp/services/webapp/doc/webapp-publication.txt'
--- lib/lp/services/webapp/doc/webapp-publication.txt	2013-04-11 03:58:54 +0000
+++ lib/lp/services/webapp/doc/webapp-publication.txt	2013-06-21 02:35:32 +0000
@@ -865,7 +865,7 @@
 be automatically reverted in a GET request.
 
     >>> from lp.services.identity.model.emailaddress import EmailAddress
-    >>> from lp.services.database.lpstorm import IMasterStore
+    >>> from lp.services.database.interfaces import IMasterStore
     >>> from lp.registry.model.person import Person
     >>> login('foo.bar@xxxxxxxxxxxxx')
     >>> txn = transaction.begin()

=== modified file 'lib/lp/services/webapp/tests/test_dbpolicy.py'
--- lib/lp/services/webapp/tests/test_dbpolicy.py	2012-09-28 07:11:03 +0000
+++ lib/lp/services/webapp/tests/test_dbpolicy.py	2013-06-21 02:35:32 +0000
@@ -37,15 +37,13 @@
     DEFAULT_FLAVOR,
     DisallowedStore,
     IDatabasePolicy,
+    IMasterStore,
+    ISlaveStore,
     IStoreSelector,
     MAIN_STORE,
     MASTER_FLAVOR,
     SLAVE_FLAVOR,
     )
-from lp.services.database.lpstorm import (
-    IMasterStore,
-    ISlaveStore,
-    )
 from lp.services.database.policy import (
     BaseDatabasePolicy,
     LaunchpadDatabasePolicy,

=== modified file 'lib/lp/services/webapp/tests/test_login.py'
--- lib/lp/services/webapp/tests/test_login.py	2013-04-11 03:58:54 +0000
+++ lib/lp/services/webapp/tests/test_login.py	2013-06-21 02:35:32 +0000
@@ -41,8 +41,10 @@
 from zope.testbrowser.testing import Browser as TestBrowser
 
 from lp.registry.interfaces.person import IPerson
-from lp.services.database.interfaces import IStoreSelector
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import (
+    IStore,
+    IStoreSelector,
+    )
 from lp.services.database.policy import MasterDatabasePolicy
 from lp.services.identity.interfaces.account import (
     AccountStatus,

=== modified file 'lib/lp/services/webapp/tests/test_publication.py'
--- lib/lp/services/webapp/tests/test_publication.py	2012-12-20 22:52:31 +0000
+++ lib/lp/services/webapp/tests/test_publication.py	2013-06-21 02:35:32 +0000
@@ -23,7 +23,7 @@
     Retry,
     )
 
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.identity.model.emailaddress import EmailAddress
 from lp.services.oauth.interfaces import (
     IOAuthConsumerSet,

=== modified file 'lib/lp/services/worlddata/model/country.py'
--- lib/lp/services/worlddata/model/country.py	2013-01-07 02:40:55 +0000
+++ lib/lp/services/worlddata/model/country.py	2013-06-21 02:35:32 +0000
@@ -13,7 +13,7 @@
 
 from lp.app.errors import NotFoundError
 from lp.services.database.constants import DEFAULT
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import SQLBase
 from lp.services.worlddata.interfaces.country import (
     IContinent,

=== modified file 'lib/lp/services/worlddata/model/language.py'
--- lib/lp/services/worlddata/model/language.py	2013-01-07 02:40:55 +0000
+++ lib/lp/services/worlddata/model/language.py	2013-06-21 02:35:32 +0000
@@ -33,7 +33,7 @@
     )
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     ISlaveStore,
     IStore,
     )

=== modified file 'lib/lp/services/worlddata/tests/test_language.py'
--- lib/lp/services/worlddata/tests/test_language.py	2012-01-01 02:58:52 +0000
+++ lib/lp/services/worlddata/tests/test_language.py	2013-06-21 02:35:32 +0000
@@ -9,7 +9,7 @@
 
 from lp.registry.interfaces.karma import IKarmaCacheManager
 from lp.registry.model.karma import KarmaCategory
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.worlddata.interfaces.language import (
     ILanguage,
     ILanguageSet,

=== modified file 'lib/lp/soyuz/adapters/archivesourcepublication.py'
--- lib/lp/soyuz/adapters/archivesourcepublication.py	2011-12-22 05:37:22 +0000
+++ lib/lp/soyuz/adapters/archivesourcepublication.py	2013-06-21 02:35:32 +0000
@@ -21,7 +21,7 @@
 
 from lp.registry.model.distroseries import DistroSeries
 from lp.registry.model.sourcepackagename import SourcePackageName
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.librarian.browser import ProxiedLibraryFileAlias
 from lp.soyuz.interfaces.publishing import (
     IPublishingSet,

=== modified file 'lib/lp/soyuz/adapters/overrides.py'
--- lib/lp/soyuz/adapters/overrides.py	2013-03-07 23:42:25 +0000
+++ lib/lp/soyuz/adapters/overrides.py	2013-06-21 02:35:32 +0000
@@ -31,7 +31,7 @@
 from lp.registry.model.sourcepackagename import SourcePackageName
 from lp.services.database import bulk
 from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.soyuz.enums import PackagePublishingStatus
 from lp.soyuz.interfaces.component import IComponentSet
 from lp.soyuz.model.binarypackagename import BinaryPackageName

=== modified file 'lib/lp/soyuz/browser/builder.py'
--- lib/lp/soyuz/browser/builder.py	2013-04-10 08:09:05 +0000
+++ lib/lp/soyuz/browser/builder.py	2013-06-21 02:35:32 +0000
@@ -39,7 +39,7 @@
     IBuilderSet,
     )
 from lp.buildmaster.model.buildqueue import BuildQueue
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.propertycache import (
     cachedproperty,
     get_property_cache,

=== modified file 'lib/lp/soyuz/model/archive.py'
--- lib/lp/soyuz/model/archive.py	2013-05-30 02:32:39 +0000
+++ lib/lp/soyuz/model/archive.py	2013-06-21 02:35:32 +0000
@@ -79,7 +79,7 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     ISlaveStore,
     IStore,
     )

=== modified file 'lib/lp/soyuz/model/archivearch.py'
--- lib/lp/soyuz/model/archivearch.py	2012-09-28 06:25:44 +0000
+++ lib/lp/soyuz/model/archivearch.py	2013-06-21 02:35:32 +0000
@@ -13,14 +13,9 @@
     Reference,
     Storm,
     )
-from zope.component import getUtility
 from zope.interface import implements
 
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.soyuz.interfaces.archivearch import (
     IArchiveArch,
     IArchiveArchSet,
@@ -46,16 +41,14 @@
 
     def new(self, archive, processorfamily):
         """See `IArchiveArchSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         archivearch = ArchiveArch()
         archivearch.archive = archive
         archivearch.processorfamily = processorfamily
-        store.add(archivearch)
+        IStore(ArchiveArch).add(archivearch)
         return archivearch
 
     def getByArchive(self, archive, processorfamily=None):
         """See `IArchiveArchSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         base_clauses = (ArchiveArch.archive == archive,)
         if processorfamily is not None:
             optional_clauses = (
@@ -63,23 +56,18 @@
         else:
             optional_clauses = ()
 
-        results = store.find(
-            ArchiveArch, *(base_clauses + optional_clauses))
-        results = results.order_by(ArchiveArch.id)
-
-        return results
+        return IStore(ArchiveArch).find(
+            ArchiveArch, *(base_clauses + optional_clauses)).order_by(
+                ArchiveArch.id)
 
     def getRestrictedFamilies(self, archive):
         """See `IArchiveArchSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         origin = (
             ProcessorFamily,
             LeftJoin(
                 ArchiveArch,
                 And(ArchiveArch.archive == archive.id,
                     ArchiveArch.processorfamily == ProcessorFamily.id)))
-        result_set = store.using(*origin).find(
+        return IStore(ArchiveArch).using(*origin).find(
             (ProcessorFamily, ArchiveArch),
-            (ProcessorFamily.restricted == True))
-
-        return result_set.order_by(ProcessorFamily.name)
+            ProcessorFamily.restricted == True).order_by(ProcessorFamily.name)

=== modified file 'lib/lp/soyuz/model/archiveauthtoken.py'
--- lib/lp/soyuz/model/archiveauthtoken.py	2012-09-28 06:25:44 +0000
+++ lib/lp/soyuz/model/archiveauthtoken.py	2013-06-21 02:35:32 +0000
@@ -19,15 +19,10 @@
     Unicode,
     )
 from storm.store import Store
-from zope.component import getUtility
 from zope.interface import implements
 
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.soyuz.interfaces.archiveauthtoken import (
     IArchiveAuthToken,
     IArchiveAuthTokenSet,
@@ -75,15 +70,12 @@
 
     def get(self, token_id):
         """See `IArchiveAuthTokenSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.get(ArchiveAuthToken, token_id)
+        return IStore(ArchiveAuthToken).get(ArchiveAuthToken, token_id)
 
     def getByToken(self, token):
         """See `IArchiveAuthTokenSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(
-            ArchiveAuthToken,
-            ArchiveAuthToken.token == token).one()
+        return IStore(ArchiveAuthToken).find(
+            ArchiveAuthToken, ArchiveAuthToken.token == token).one()
 
     def getByArchive(self, archive):
         """See `IArchiveAuthTokenSet`."""

=== modified file 'lib/lp/soyuz/model/archivepermission.py'
--- lib/lp/soyuz/model/archivepermission.py	2012-09-28 06:25:44 +0000
+++ lib/lp/soyuz/model/archivepermission.py	2013-06-21 02:35:32 +0000
@@ -42,11 +42,6 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
 from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-from lp.services.database.lpstorm import (
     IMasterStore,
     IStore,
     )
@@ -239,8 +234,7 @@
 
     def permissionsForPerson(self, archive, person):
         """See `IArchivePermissionSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(
+        return IStore(ArchivePermission).find(
             ArchivePermission, """
             ArchivePermission.archive = %s AND
             EXISTS (SELECT TeamParticipation.person

=== modified file 'lib/lp/soyuz/model/binarypackagebuild.py'
--- lib/lp/soyuz/model/binarypackagebuild.py	2013-03-28 08:06:22 +0000
+++ lib/lp/soyuz/model/binarypackagebuild.py	2013-06-21 02:35:32 +0000
@@ -55,12 +55,7 @@
 from lp.services.database.bulk import load_related
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import DBEnum
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,
@@ -1161,7 +1156,6 @@
             return
 
         build_ids = [build.id for build in results]
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         origin = (
             BinaryPackageBuild,
             Join(
@@ -1178,7 +1172,7 @@
                      LibraryFileContent.id == LibraryFileAlias.contentID),
             LeftJoin(Builder, Builder.id == BinaryPackageBuild.builder_id),
             )
-        result_set = store.using(*origin).find(
+        result_set = IStore(BinaryPackageBuild).using(*origin).find(
             (SourcePackageRelease, LibraryFileAlias, SourcePackageName,
              LibraryFileContent, Builder),
             BinaryPackageBuild.id.is_in(build_ids))
@@ -1192,19 +1186,14 @@
 
     def getByQueueEntry(self, queue_entry):
         """See `IBinaryPackageBuildSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result_set = store.find(
+        return IStore(BinaryPackageBuild).find(
             BinaryPackageBuild,
             BuildPackageJob.build == BinaryPackageBuild.id,
             BuildPackageJob.job == BuildQueue.jobID,
-            BuildQueue.job == queue_entry.job)
-
-        return result_set.one()
+            BuildQueue.job == queue_entry.job).one()
 
     def getQueueEntriesForBuildIDs(self, build_ids):
         """See `IBinaryPackageBuildSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-
         origin = (
             BuildPackageJob,
             Join(BuildQueue, BuildPackageJob.job == BuildQueue.jobID),
@@ -1215,8 +1204,6 @@
                 Builder,
                 BuildQueue.builderID == Builder.id),
             )
-        result_set = store.using(*origin).find(
+        return IStore(BinaryPackageBuild).using(*origin).find(
             (BuildQueue, Builder, BuildPackageJob),
             BinaryPackageBuild.id.is_in(build_ids))
-
-        return result_set

=== modified file 'lib/lp/soyuz/model/binarypackagename.py'
--- lib/lp/soyuz/model/binarypackagename.py	2013-01-07 02:40:55 +0000
+++ lib/lp/soyuz/model/binarypackagename.py	2013-06-21 02:35:32 +0000
@@ -19,7 +19,7 @@
 from zope.schema.vocabulary import SimpleTerm
 
 from lp.app.errors import NotFoundError
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,

=== modified file 'lib/lp/soyuz/model/buildpackagejob.py'
--- lib/lp/soyuz/model/buildpackagejob.py	2013-05-24 01:28:22 +0000
+++ lib/lp/soyuz/model/buildpackagejob.py	2013-06-21 02:35:32 +0000
@@ -21,7 +21,7 @@
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.registry.interfaces.series import SeriesStatus
 from lp.services.database.bulk import load_related
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import sqlvalues
 from lp.soyuz.enums import (
     ArchivePurpose,

=== modified file 'lib/lp/soyuz/model/distributionjob.py'
--- lib/lp/soyuz/model/distributionjob.py	2012-04-13 20:58:40 +0000
+++ lib/lp/soyuz/model/distributionjob.py	2013-06-21 02:35:32 +0000
@@ -21,7 +21,7 @@
 from lp.registry.model.distribution import Distribution
 from lp.registry.model.distroseries import DistroSeries
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.stormbase import StormBase
 from lp.services.job.model.job import (
     EnumeratedSubclass,

=== modified file 'lib/lp/soyuz/model/distributionsourcepackagecache.py'
--- lib/lp/soyuz/model/distributionsourcepackagecache.py	2013-01-07 02:40:55 +0000
+++ lib/lp/soyuz/model/distributionsourcepackagecache.py	2013-06-21 02:35:32 +0000
@@ -14,7 +14,7 @@
 
 from lp.registry.model.sourcepackagename import SourcePackageName
 from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,

=== modified file 'lib/lp/soyuz/model/distroarchseries.py'
--- lib/lp/soyuz/model/distroarchseries.py	2013-06-06 06:59:55 +0000
+++ lib/lp/soyuz/model/distroarchseries.py	2013-06-21 02:35:32 +0000
@@ -31,11 +31,7 @@
 from lp.services.database.constants import DEFAULT
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    SLAVE_FLAVOR,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,
@@ -197,7 +193,6 @@
         """See `IDistroArchSeries`."""
         from lp.soyuz.model.publishing import BinaryPackagePublishingHistory
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, SLAVE_FLAVOR)
         origin = [
             BinaryPackageRelease,
             Join(
@@ -236,7 +231,7 @@
                 Or(
                     SQL("BinaryPackageRelease.fti @@ ftq(?)", params=(text,)),
                     BinaryPackageName.name.contains_string(text.lower())))
-        result = store.using(*origin).find(
+        result = IStore(BinaryPackageName).using(*origin).find(
             find_spec, *clauses).config(distinct=True)
 
         if text:

=== modified file 'lib/lp/soyuz/model/distroarchseriesbinarypackage.py'
--- lib/lp/soyuz/model/distroarchseriesbinarypackage.py	2013-01-07 02:40:55 +0000
+++ lib/lp/soyuz/model/distroarchseriesbinarypackage.py	2013-06-21 02:35:32 +0000
@@ -13,7 +13,7 @@
 from zope.interface import implements
 
 from lp.app.errors import NotFoundError
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import sqlvalues
 from lp.services.propertycache import cachedproperty
 from lp.soyuz.enums import PackagePublishingStatus

=== modified file 'lib/lp/soyuz/model/distroseriesdifferencejob.py'
--- lib/lp/soyuz/model/distroseriesdifferencejob.py	2013-02-14 01:10:48 +0000
+++ lib/lp/soyuz/model/distroseriesdifferencejob.py	2013-06-21 02:35:32 +0000
@@ -23,7 +23,7 @@
 from lp.registry.model.sourcepackagename import SourcePackageName
 from lp.services.config import config
 from lp.services.database import bulk
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/soyuz/model/distroseriespackagecache.py'
--- lib/lp/soyuz/model/distroseriespackagecache.py	2013-01-07 02:40:55 +0000
+++ lib/lp/soyuz/model/distroseriespackagecache.py	2013-06-21 02:35:32 +0000
@@ -16,7 +16,7 @@
     )
 from zope.interface import implements
 
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,

=== modified file 'lib/lp/soyuz/model/initializedistroseriesjob.py'
--- lib/lp/soyuz/model/initializedistroseriesjob.py	2012-04-20 18:28:17 +0000
+++ lib/lp/soyuz/model/initializedistroseriesjob.py	2013-06-21 02:35:32 +0000
@@ -14,7 +14,7 @@
 
 from lp.registry.model.distroseries import DistroSeries
 from lp.services.config import config
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/soyuz/model/packagecloner.py'
--- lib/lp/soyuz/model/packagecloner.py	2013-02-13 14:16:37 +0000
+++ lib/lp/soyuz/model/packagecloner.py	2013-06-21 02:35:32 +0000
@@ -18,11 +18,7 @@
 
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     quote,
     sqlvalues,
@@ -30,6 +26,7 @@
 from lp.soyuz.enums import PackagePublishingStatus
 from lp.soyuz.interfaces.archivearch import IArchiveArchSet
 from lp.soyuz.interfaces.packagecloner import IPackageCloner
+from lp.soyuz.model.publishing import BinaryPackagePublishingHistory
 
 
 def clone_packages(origin, destination, distroarchseries_list=None):
@@ -170,7 +167,6 @@
             the copy to
         @type sourcepackagenames: Iterable
         """
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         use_names = (sourcepackagenames and len(sourcepackagenames) > 0)
         clause_tables = "FROM BinaryPackagePublishingHistory AS bpph"
         if use_names:
@@ -225,7 +221,7 @@
                 AND spn.name IN %s
             """ % sqlvalues(sourcepackagenames)
 
-        store.execute(query)
+        IStore(BinaryPackagePublishingHistory).execute(query)
 
     def mergeCopy(self, origin, destination):
         """Please see `IPackageCloner`."""
@@ -234,7 +230,7 @@
         self.packageSetDiff(origin, destination)
 
         # Now copy the fresher or new packages.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(BinaryPackagePublishingHistory)
         store.execute("""
             INSERT INTO SourcePackagePublishingHistory (
                 sourcepackagerelease, distroseries, status, component,
@@ -286,7 +282,7 @@
         This means finding out which packages in a given source archive are
         fresher or new with respect to a target archive.
         """
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(BinaryPackagePublishingHistory)
         # The query below will find all packages in the source archive that
         # are fresher than their counterparts in the target archive.
         find_newer_packages = """
@@ -373,7 +369,7 @@
         table that lists what packages exist in the target archive
         (additionally considering the distroseries, pocket and component).
         """
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(BinaryPackagePublishingHistory)
         # Use a temporary table to hold the data needed for the package set
         # delta computation. This will prevent multiple, parallel delta
         # calculations from interfering with each other.
@@ -449,7 +445,7 @@
         @param sourcepackagenames: List of source packages to restrict
             the copy to
         """
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(BinaryPackagePublishingHistory)
         query = '''
             INSERT INTO SourcePackagePublishingHistory (
                 sourcepackagerelease, distroseries, status, component,
@@ -510,7 +506,7 @@
     def packageSetDiff(self, origin, destination, logger=None):
         """Please see `IPackageCloner`."""
         # Find packages that are obsolete or missing in the target archive.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(BinaryPackagePublishingHistory)
         self._init_packageset_delta(destination)
         self._compute_packageset_delta(origin)
 

=== modified file 'lib/lp/soyuz/model/packagecopyjob.py'
--- lib/lp/soyuz/model/packagecopyjob.py	2013-03-07 17:45:10 +0000
+++ lib/lp/soyuz/model/packagecopyjob.py	2013-06-21 02:35:32 +0000
@@ -44,7 +44,7 @@
 from lp.services.database import bulk
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/soyuz/model/packagecopyrequest.py'
--- lib/lp/soyuz/model/packagecopyrequest.py	2012-09-28 06:25:44 +0000
+++ lib/lp/soyuz/model/packagecopyrequest.py	2013-06-21 02:35:32 +0000
@@ -15,17 +15,12 @@
     Storm,
     Unicode,
     )
-from zope.component import getUtility
 from zope.interface import implements
 
 from lp.registry.interfaces.person import validate_public_person
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.soyuz.enums import PackageCopyStatus
 from lp.soyuz.interfaces.packagecopyrequest import (
     IPackageCopyRequest,
@@ -166,10 +161,8 @@
     """See `IPackageCopyRequestSet`."""
     implements(IPackageCopyRequestSet)
 
-    def new(
-        self, source, target, requester, copy_binaries=False, reason=None):
+    def new(self, source, target, requester, copy_binaries=False, reason=None):
         """See `IPackageCopyRequestSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         pcr = PackageCopyRequest()
         for location_data in ((source, 'source'), (target, 'target')):
             _set_location_data(pcr, *location_data)
@@ -180,37 +173,33 @@
             pcr.reason = reason
 
         pcr.status = PackageCopyStatus.NEW
-        store.add(pcr)
+        IStore(PackageCopyRequest).add(pcr)
         return pcr
 
     def getByPersonAndStatus(self, requester, status=None):
         """See `IPackageCopyRequestSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         base_clauses = (PackageCopyRequest.requester == requester,)
         if status is not None:
             optional_clauses = (PackageCopyRequest.status == status,)
         else:
             optional_clauses = ()
-        return store.find(
+        return IStore(PackageCopyRequest).find(
             PackageCopyRequest, *(base_clauses + optional_clauses))
 
     def getByTargetDistroSeries(self, distroseries):
         """See `IPackageCopyRequestSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(
+        return IStore(PackageCopyRequest).find(
             PackageCopyRequest,
             PackageCopyRequest.target_distroseries == distroseries)
 
     def getBySourceDistroSeries(self, distroseries):
         """See `IPackageCopyRequestSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(
+        return IStore(PackageCopyRequest).find(
             PackageCopyRequest,
             PackageCopyRequest.source_distroseries == distroseries)
 
     def getByTargetArchive(self, archive):
         """See `IPackageCopyRequestSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(
+        return IStore(PackageCopyRequest).find(
             PackageCopyRequest,
             PackageCopyRequest.target_archive == archive)

=== modified file 'lib/lp/soyuz/model/packagediff.py'
--- lib/lp/soyuz/model/packagediff.py	2012-09-28 06:25:44 +0000
+++ lib/lp/soyuz/model/packagediff.py	2013-06-21 02:35:32 +0000
@@ -25,12 +25,7 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     SQLBase,
     sqlvalues,
@@ -152,7 +147,6 @@
     def _countDeletedLFAs(self):
         """How many files associated with either source package have been
         deleted from the librarian?"""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         query = """
             SELECT COUNT(lfa.id)
             FROM
@@ -164,7 +158,7 @@
                 AND sprf.libraryfile = lfa.id
                 AND lfa.content IS NULL
             """ % sqlvalues((self.from_source.id, self.to_source.id))
-        result = store.execute(query).get_one()
+        result = IStore(LibraryFileAlias).execute(query).get_one()
         return (0 if result is None else result[0])
 
     def performDiff(self):
@@ -271,11 +265,10 @@
         return PackageDiff.get(diff_id)
 
     def getPendingDiffs(self, limit=None):
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result = store.find(
-            PackageDiff, PackageDiff.status == PackageDiffStatus.PENDING)
-        result.order_by(PackageDiff.id)
-        return result.config(limit=limit)
+        return IStore(PackageDiff).find(
+            PackageDiff,
+            PackageDiff.status == PackageDiffStatus.PENDING).order_by(
+                PackageDiff.id).config(limit=limit)
 
     def getDiffsToReleases(self, sprs, preload_for_display=False):
         """See `IPackageDiffSet`."""
@@ -284,9 +277,8 @@
         from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
         if len(sprs) == 0:
             return EmptyResultSet()
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         spr_ids = [spr.id for spr in sprs]
-        result = store.find(
+        result = IStore(PackageDiff).find(
             PackageDiff, PackageDiff.to_sourceID.is_in(spr_ids))
         result.order_by(PackageDiff.to_sourceID,
                         Desc(PackageDiff.date_requested))

=== modified file 'lib/lp/soyuz/model/packageset.py'
--- lib/lp/soyuz/model/packageset.py	2012-09-11 15:43:33 +0000
+++ lib/lp/soyuz/model/packageset.py	2013-06-21 02:35:32 +0000
@@ -24,7 +24,7 @@
     ISourcePackageNameSet,
     )
 from lp.registry.model.sourcepackagename import SourcePackageName
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/soyuz/model/processacceptedbugsjob.py'
--- lib/lp/soyuz/model/processacceptedbugsjob.py	2012-09-28 06:25:44 +0000
+++ lib/lp/soyuz/model/processacceptedbugsjob.py	2013-06-21 02:35:32 +0000
@@ -28,11 +28,9 @@
 from lp.registry.model.distroseries import DistroSeries
 from lp.services.config import config
 from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
+    IMasterStore,
+    IStore,
     )
-from lp.services.database.lpstorm import IMasterStore
 from lp.services.database.stormbase import StormBase
 from lp.services.job.model.job import Job
 from lp.services.job.runner import BaseRunnableJob
@@ -143,8 +141,7 @@
     @staticmethod
     def iterReady():
         """See `IJobSource`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find((ProcessAcceptedBugsJob),
+        return IStore(ProcessAcceptedBugsJob).find((ProcessAcceptedBugsJob),
             And(ProcessAcceptedBugsJob.job == Job.id,
                 Job.id.is_in(Job.ready_jobs)))
 

=== modified file 'lib/lp/soyuz/model/processor.py'
--- lib/lp/soyuz/model/processor.py	2013-01-07 02:40:55 +0000
+++ lib/lp/soyuz/model/processor.py	2013-06-21 02:35:32 +0000
@@ -10,14 +10,9 @@
     StringCol,
     )
 from storm.locals import Bool
-from zope.component import getUtility
 from zope.interface import implements
 
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import SQLBase
 from lp.soyuz.interfaces.processor import (
     IProcessor,
@@ -48,16 +43,15 @@
 
     def getByName(self, name):
         """See `IProcessorSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        processor = store.find(Processor, Processor.name == name).one()
+        processor = IStore(Processor).find(
+            Processor, Processor.name == name).one()
         if processor is None:
             raise ProcessorNotFound(name)
         return processor
 
     def getAll(self):
         """See `IProcessorSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(Processor)
+        return IStore(Processor).find(Processor)
 
 
 class ProcessorFamily(SQLBase):
@@ -88,25 +82,23 @@
         # Please note that ProcessorFamily.name is unique i.e. the database
         # will return a result set that's either empty or contains just one
         # ProcessorFamily row.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        rset = store.find(ProcessorFamily, ProcessorFamily.name == name)
-        return rset.one()
+        return IStore(ProcessorFamily).find(
+            ProcessorFamily, ProcessorFamily.name == name).one()
 
     def getRestricted(self):
         """See `IProcessorFamilySet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(ProcessorFamily, ProcessorFamily.restricted == True)
+        return IStore(ProcessorFamily).find(
+            ProcessorFamily, ProcessorFamily.restricted == True)
 
     def getByProcessorName(self, name):
         """Please see `IProcessorFamilySet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        rset = store.find(
-            ProcessorFamily,
-            Processor.name == name, Processor.family == ProcessorFamily.id)
         # Each `Processor` is associated with exactly one `ProcessorFamily`
         # but there is also the possibility that the user specified a name for
         # a non-existent processor.
-        return rset.one()
+        return IStore(ProcessorFamily).find(
+            ProcessorFamily,
+            Processor.name == name,
+            Processor.family == ProcessorFamily.id).one()
 
     def new(self, name, title, description, restricted=False):
         """See `IProcessorFamily`."""

=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py	2013-06-18 05:49:05 +0000
+++ lib/lp/soyuz/model/publishing.py	2013-06-21 02:35:32 +0000
@@ -61,11 +61,6 @@
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
 from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-from lp.services.database.lpstorm import (
     IMasterStore,
     IStore,
     )
@@ -1573,7 +1568,7 @@
         if build_states is not None:
             extra_exprs.append(BinaryPackageBuild.status.is_in(build_states))
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(SourcePackagePublishingHistory)
 
         # We'll be looking for builds in the same distroseries as the
         # SPPH for the same release.
@@ -1713,7 +1708,7 @@
         source_publication_ids = self._extractIDs(
             one_or_more_source_publications)
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(SourcePackagePublishingHistory)
         published_builds = store.find(
             (SourcePackagePublishingHistory, BinaryPackageBuild,
                 DistroArchSeries),
@@ -1739,7 +1734,7 @@
         source_publication_ids = self._extractIDs(
             one_or_more_source_publications)
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(SourcePackagePublishingHistory)
         binary_result = store.find(
             (SourcePackagePublishingHistory, LibraryFileAlias,
              LibraryFileContent),
@@ -1763,7 +1758,7 @@
         source_publication_ids = self._extractIDs(
             one_or_more_source_publications)
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(SourcePackagePublishingHistory)
         source_result = store.find(
             (SourcePackagePublishingHistory, LibraryFileAlias,
              LibraryFileContent),
@@ -1786,8 +1781,7 @@
         source_publication_ids = self._extractIDs(
             one_or_more_source_publications)
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result_set = store.find(
+        result_set = IStore(SourcePackagePublishingHistory).find(
             (SourcePackagePublishingHistory, BinaryPackagePublishingHistory,
              BinaryPackageRelease, BinaryPackageName, DistroArchSeries),
             self._getSourceBinaryJoinForSources(source_publication_ids))
@@ -1804,7 +1798,7 @@
         """See `PublishingSet`."""
         source_publication_ids = self._extractIDs(
             one_or_more_source_publications)
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(SourcePackagePublishingHistory)
         origin = (
             SourcePackagePublishingHistory,
             PackageDiff,
@@ -1834,8 +1828,7 @@
         source_publication_ids = self._extractIDs(
             one_or_more_source_publications)
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result_set = store.find(
+        result_set = IStore(SourcePackagePublishingHistory).find(
             (SourcePackagePublishingHistory, PackageUpload,
              SourcePackageRelease, LibraryFileAlias, LibraryFileContent),
             LibraryFileContent.id == LibraryFileAlias.contentID,
@@ -1860,16 +1853,14 @@
         # Avoid circular imports.
         from lp.soyuz.model.queue import PackageUpload, PackageUploadSource
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result_set = store.find(
+        return IStore(SourcePackagePublishingHistory).find(
             LibraryFileAlias,
             LibraryFileAlias.id == PackageUpload.changes_file_id,
             PackageUpload.status == PackageUploadStatus.DONE,
             PackageUpload.distroseriesID == spr.upload_distroseries.id,
             PackageUpload.archiveID == spr.upload_archive.id,
             PackageUpload.id == PackageUploadSource.packageuploadID,
-            PackageUploadSource.sourcepackagereleaseID == spr.id)
-        return result_set.one()
+            PackageUploadSource.sourcepackagereleaseID == spr.id).one()
 
     def getBuildStatusSummariesForSourceIdsAndArchive(self, source_ids,
         archive):
@@ -1878,7 +1869,7 @@
         if not source_ids:
             return {}
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(SourcePackagePublishingHistory)
         # Find relevant builds while also getting PackageBuilds and
         # BuildFarmJobs into the cache. They're used later.
         build_info = list(

=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py	2013-06-04 04:19:41 +0000
+++ lib/lp/soyuz/model/queue.py	2013-06-21 02:35:32 +0000
@@ -59,7 +59,7 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/soyuz/model/sourcepackageformat.py'
--- lib/lp/soyuz/model/sourcepackageformat.py	2012-09-28 06:25:44 +0000
+++ lib/lp/soyuz/model/sourcepackageformat.py	2013-06-21 02:35:32 +0000
@@ -13,15 +13,12 @@
     Reference,
     Storm,
     )
-from zope.component import getUtility
 from zope.interface import implements
 
 from lp.services.database.enumcol import DBEnum
 from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
+    IMasterStore,
+    IStore,
     )
 from lp.soyuz.enums import SourcePackageFormat
 from lp.soyuz.interfaces.sourcepackageformat import (
@@ -52,15 +49,13 @@
 
     def getBySeriesAndFormat(self, distroseries, format):
         """See `ISourcePackageFormatSelection`."""
-        return getUtility(IStoreSelector).get(
-            MAIN_STORE, DEFAULT_FLAVOR).find(
-                SourcePackageFormatSelection, distroseries=distroseries,
-                format=format).one()
+        return IStore(SourcePackageFormatSelection).find(
+            SourcePackageFormatSelection, distroseries=distroseries,
+            format=format).one()
 
     def add(self, distroseries, format):
         """See `ISourcePackageFormatSelection`."""
         spfs = SourcePackageFormatSelection()
         spfs.distroseries = distroseries
         spfs.format = format
-        return getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR).add(
-            spfs)
+        return IMasterStore(SourcePackageFormatSelection).add(spfs)

=== modified file 'lib/lp/soyuz/scripts/expire_archive_files.py'
--- lib/lp/soyuz/scripts/expire_archive_files.py	2013-01-11 09:38:09 +0000
+++ lib/lp/soyuz/scripts/expire_archive_files.py	2013-06-21 02:35:32 +0000
@@ -3,16 +3,11 @@
 # Copyright 2009 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
-from zope.component import getUtility
-
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import sqlvalues
 from lp.services.scripts.base import LaunchpadCronScript
 from lp.soyuz.enums import ArchivePurpose
+from lp.soyuz.model.archive import Archive
 
 # PPA owners that we never want to expire.
 BLACKLISTED_PPAS = """
@@ -180,8 +175,7 @@
         num_days = self.options.num_days
         self.logger.info("Expiring files up to %d days ago" % num_days)
 
-        self.store = getUtility(IStoreSelector).get(
-            MAIN_STORE, DEFAULT_FLAVOR)
+        self.store = IStore(Archive)
 
         lfa_ids = self.determineSourceExpirables(num_days)
         lfa_ids.extend(self.determineBinaryExpirables(num_days))
@@ -211,4 +205,3 @@
             self.txn.commit()
 
         self.logger.info('Finished PPA binary expiration')
-

=== modified file 'lib/lp/soyuz/scripts/initialize_distroseries.py'
--- lib/lp/soyuz/scripts/initialize_distroseries.py	2013-05-01 18:39:38 +0000
+++ lib/lp/soyuz/scripts/initialize_distroseries.py	2013-06-21 02:35:32 +0000
@@ -21,7 +21,7 @@
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.registry.model.distroseries import DistroSeries
 from lp.services.database import bulk
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.database.sqlbase import sqlvalues
 from lp.services.helpers import ensure_unicode
 from lp.soyuz.adapters.packagelocation import PackageLocation

=== modified file 'lib/lp/soyuz/scripts/retrydepwait.py'
--- lib/lp/soyuz/scripts/retrydepwait.py	2013-02-04 06:14:32 +0000
+++ lib/lp/soyuz/scripts/retrydepwait.py	2013-06-21 02:35:32 +0000
@@ -13,7 +13,7 @@
 from lp.registry.interfaces.series import SeriesStatus
 from lp.registry.model.sourcepackagename import SourcePackageName
 from lp.services.database.bulk import load_related
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.looptuner import (
     LoopTuner,
     TunableLoop,

=== modified file 'lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py'
--- lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py	2013-05-01 18:39:38 +0000
+++ lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py	2013-06-21 02:35:32 +0000
@@ -15,7 +15,7 @@
     )
 from lp.registry.interfaces.distroseriesparent import IDistroSeriesParentSet
 from lp.registry.interfaces.pocket import PackagePublishingPocket
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.soyuz.enums import (
     ArchivePurpose,
     PackageUploadStatus,

=== modified file 'lib/lp/soyuz/scripts/tests/test_ppa_apache_log_parser.py'
--- lib/lp/soyuz/scripts/tests/test_ppa_apache_log_parser.py	2012-09-28 06:25:44 +0000
+++ lib/lp/soyuz/scripts/tests/test_ppa_apache_log_parser.py	2013-06-21 02:35:32 +0000
@@ -7,11 +7,7 @@
 from zope.component import getUtility
 
 from lp.registry.interfaces.person import IPersonSet
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.worlddata.interfaces.country import ICountrySet
 from lp.soyuz.model.binarypackagerelease import (
     BinaryPackageReleaseDownloadCount,
@@ -78,8 +74,7 @@
         self.publisher = SoyuzTestPublisher()
         self.publisher.prepareBreezyAutotest()
 
-        self.store = getUtility(IStoreSelector).get(
-            MAIN_STORE, DEFAULT_FLAVOR)
+        self.store = IStore(BinaryPackageReleaseDownloadCount)
 
         self.archive = getUtility(IPersonSet).getByName('cprov').archive
         self.archive.require_virtualized = False

=== modified file 'lib/lp/soyuz/stories/ppa/xx-delete-packages.txt'
--- lib/lp/soyuz/stories/ppa/xx-delete-packages.txt	2013-05-09 08:53:01 +0000
+++ lib/lp/soyuz/stories/ppa/xx-delete-packages.txt	2013-06-21 02:35:32 +0000
@@ -240,7 +240,7 @@
     Deletion comment: DO IT AGAIN !
 
     >>> from lp.services.database.constants import UTC_NOW
-    >>> from lp.services.database.lpstorm import IStore
+    >>> from lp.services.database.interfaces import IStore
     >>> from lp.soyuz.model.publishing import SourcePackagePublishingHistory
     >>> IStore(SourcePackagePublishingHistory).find(
     ...     SourcePackagePublishingHistory,

=== modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-files.txt'
--- lib/lp/soyuz/stories/ppa/xx-ppa-files.txt	2013-01-22 02:06:59 +0000
+++ lib/lp/soyuz/stories/ppa/xx-ppa-files.txt	2013-06-21 02:35:32 +0000
@@ -343,11 +343,10 @@
 
     # Attach an existing file (the 'test-pkg_1.0.dsc') to a deleted
     # LibraryFileContent.
-    >>> from lp.services.database.interfaces import (
-    ...     IStoreSelector, MAIN_STORE, MASTER_FLAVOR)
+    >>> from lp.soyuz.model.archive import Archive
+    >>> from lp.services.database.interfaces import IMasterStore
     >>> login('foo.bar@xxxxxxxxxxxxx')
-    >>> store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
-    >>> store.commit()
+    >>> IMasterStore(Archive).commit()
     >>> from zope.security.proxy import removeSecurityProxy
     >>> removeSecurityProxy(dsc_file).content = None
     >>> transaction.commit()

=== modified file 'lib/lp/soyuz/stories/soyuz/xx-person-packages.txt'
--- lib/lp/soyuz/stories/soyuz/xx-person-packages.txt	2013-05-01 23:26:47 +0000
+++ lib/lp/soyuz/stories/soyuz/xx-person-packages.txt	2013-06-21 02:35:32 +0000
@@ -168,14 +168,11 @@
     >>> from lp.services.database.sqlbase import flush_database_updates
     >>> from lp.services.log.logger import FakeLogger
     >>> from lp.testing.dbuser import switch_dbuser
-    >>> from lp.services.database.interfaces import (
-    ...     IStoreSelector,
-    ...     MAIN_STORE,
-    ...     MASTER_FLAVOR,
-    ...     )
+    >>> from lp.soyuz.model.archive import Archive
+    >>> from lp.services.database.interfaces import IMasterStore
 
     >>> def update_cached_records(delete_all=False):
-    ...     store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+    ...     store = IMasterStore(Archive)
     ...     if delete_all:
     ...         store.execute(
     ...             "delete from latestpersonsourcepackagereleasecache")

=== modified file 'lib/lp/soyuz/stories/webservice/xx-packageset.txt'
--- lib/lp/soyuz/stories/webservice/xx-packageset.txt	2012-09-30 16:53:08 +0000
+++ lib/lp/soyuz/stories/webservice/xx-packageset.txt	2013-06-21 02:35:32 +0000
@@ -116,11 +116,9 @@
 
 Populate the 'umbrella' package set with source packages.
 
-    >>> from lp.services.database.interfaces import (
-    ...     IStoreSelector, MAIN_STORE, DEFAULT_FLAVOR)
+    >>> from lp.services.database.interfaces import IStore
     >>> from lp.registry.model.sourcepackagename import SourcePackageName
-    >>> store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-    >>> all_spns = store.find(SourcePackageName)
+    >>> all_spns = IStore(SourcePackageName).find(SourcePackageName)
     >>> response = webservice.named_post(
     ...     '/package-sets/hoary/umbrella', 'addSources', {},
     ...     names=[spn.name for spn in all_spns])

=== modified file 'lib/lp/soyuz/tests/test_archive.py'
--- lib/lp/soyuz/tests/test_archive.py	2013-05-24 01:28:22 +0000
+++ lib/lp/soyuz/tests/test_archive.py	2013-06-21 02:35:32 +0000
@@ -34,11 +34,7 @@
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.registry.interfaces.series import SeriesStatus
 from lp.registry.interfaces.teammembership import TeamMembershipStatus
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import sqlvalues
 from lp.services.job.interfaces.job import JobStatus
 from lp.services.propertycache import clear_property_cache
@@ -77,7 +73,10 @@
 from lp.soyuz.interfaces.component import IComponentSet
 from lp.soyuz.interfaces.packagecopyjob import IPlainPackageCopyJobSource
 from lp.soyuz.interfaces.processor import IProcessorFamilySet
-from lp.soyuz.model.archive import validate_ppa
+from lp.soyuz.model.archive import (
+    Archive,
+    validate_ppa,
+    )
 from lp.soyuz.model.archivepermission import (
     ArchivePermission,
     ArchivePermissionSet,
@@ -305,8 +304,7 @@
                 AND Job.status = %s;
         """ % sqlvalues(archive, BuildStatus.NEEDSBUILD, status)
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.execute(query).get_one()[0]
+        return IStore(Archive).execute(query).get_one()[0]
 
     def assertNoBuildJobsHaveStatus(self, archive, status):
         # Check that that the jobs attached to this archive do not have this
@@ -900,8 +898,7 @@
         self.publisher = SoyuzTestPublisher()
         self.publisher.prepareBreezyAutotest()
 
-        self.store = getUtility(IStoreSelector).get(
-            MAIN_STORE, DEFAULT_FLAVOR)
+        self.store = IStore(Archive)
 
         self.archive = self.factory.makeArchive()
         self.bpr_1 = self.publisher.getPubBinaries(

=== modified file 'lib/lp/soyuz/tests/test_buildpackagejob.py'
--- lib/lp/soyuz/tests/test_buildpackagejob.py	2013-05-24 01:28:22 +0000
+++ lib/lp/soyuz/tests/test_buildpackagejob.py	2013-06-21 02:35:32 +0000
@@ -15,11 +15,7 @@
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.registry.interfaces.series import SeriesStatus
 from lp.registry.interfaces.sourcepackage import SourcePackageUrgency
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.log.logger import DevNullLogger
 from lp.services.webapp.interfaces import OAuthPermission
 from lp.soyuz.enums import (
@@ -157,7 +153,7 @@
         # j=job, p=processor, v=virtualized, e=estimated_duration, s=score
 
         # First mark all builds in the sample data as already built.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(BinaryPackageBuild)
         sample_data = store.find(BinaryPackageBuild)
         for build in sample_data:
             build.buildstate = BuildStatus.FULLYBUILT
@@ -480,7 +476,7 @@
             self.assertScoreWriteableByTeam(
                 archive, getUtility(ILaunchpadCelebrities).commercial_admin)
 
-            
+
 class TestBuildPackageJobPostProcess(TestCaseWithFactory):
 
     layer = DatabaseFunctionalLayer

=== modified file 'lib/lp/soyuz/tests/test_distroseriesdifferencejob.py'
--- lib/lp/soyuz/tests/test_distroseriesdifferencejob.py	2013-02-14 01:10:48 +0000
+++ lib/lp/soyuz/tests/test_distroseriesdifferencejob.py	2013-06-21 02:35:32 +0000
@@ -19,7 +19,7 @@
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.registry.model.distroseriesdifference import DistroSeriesDifference
 from lp.services.database import bulk
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.features.testing import FeatureFixture
 from lp.services.job.interfaces.job import JobStatus
 from lp.services.job.tests import block_on_job

=== modified file 'lib/lp/soyuz/tests/test_hasbuildrecords.py'
--- lib/lp/soyuz/tests/test_hasbuildrecords.py	2013-02-01 03:52:36 +0000
+++ lib/lp/soyuz/tests/test_hasbuildrecords.py	2013-06-21 02:35:32 +0000
@@ -17,7 +17,7 @@
 from lp.registry.interfaces.person import IPersonSet
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.registry.model.sourcepackage import SourcePackage
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.soyuz.enums import ArchivePurpose
 from lp.soyuz.interfaces.binarypackagebuild import IBinaryPackageBuild
 from lp.soyuz.interfaces.buildrecords import (

=== modified file 'lib/lp/soyuz/tests/test_packagecopyjob.py'
--- lib/lp/soyuz/tests/test_packagecopyjob.py	2013-06-04 04:19:41 +0000
+++ lib/lp/soyuz/tests/test_packagecopyjob.py	2013-06-21 02:35:32 +0000
@@ -24,7 +24,7 @@
     DistroSeriesDifferenceComment,
     )
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.features.testing import FeatureFixture
 from lp.services.job.interfaces.job import JobStatus
 from lp.services.job.runner import JobRunner

=== modified file 'lib/lp/soyuz/tests/test_packagediff.py'
--- lib/lp/soyuz/tests/test_packagediff.py	2012-09-28 06:25:44 +0000
+++ lib/lp/soyuz/tests/test_packagediff.py	2013-06-21 02:35:32 +0000
@@ -7,17 +7,13 @@
 
 from datetime import datetime
 
-from zope.component import getUtility
 from zope.security.proxy import removeSecurityProxy
 
 from lp.services.config import config
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import sqlvalues
 from lp.soyuz.enums import PackageDiffStatus
+from lp.soyuz.model.archive import Archive
 from lp.soyuz.tests.soyuz import TestPackageDiffsBase
 from lp.testing import TestCaseWithFactory
 from lp.testing.dbuser import dbuser
@@ -41,7 +37,7 @@
         """Expire the files associated with the given source package in the
         librarian."""
         assert expire or delete
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(Archive)
         query = """
             UPDATE LibraryFileAlias lfa
             SET

=== modified file 'lib/lp/soyuz/tests/test_packageset.py'
--- lib/lp/soyuz/tests/test_packageset.py	2012-11-26 08:33:03 +0000
+++ lib/lp/soyuz/tests/test_packageset.py	2013-06-21 02:35:32 +0000
@@ -10,7 +10,7 @@
 from lp.registry.errors import NoSuchSourcePackageName
 from lp.registry.interfaces.distribution import IDistributionSet
 from lp.registry.interfaces.series import SeriesStatus
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.soyuz.enums import ArchivePermissionType
 from lp.soyuz.interfaces.archivepermission import IArchivePermissionSet
 from lp.soyuz.interfaces.packageset import (

=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
--- lib/lp/soyuz/tests/test_packageupload.py	2013-05-28 01:24:33 +0000
+++ lib/lp/soyuz/tests/test_packageupload.py	2013-06-21 02:35:32 +0000
@@ -27,7 +27,7 @@
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.registry.interfaces.series import SeriesStatus
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.job.interfaces.job import JobStatus
 from lp.services.librarian.browser import ProxiedLibraryFileAlias
 from lp.services.mail import stub

=== modified file 'lib/lp/soyuz/tests/test_processaccepted.py'
--- lib/lp/soyuz/tests/test_processaccepted.py	2012-09-27 02:53:00 +0000
+++ lib/lp/soyuz/tests/test_processaccepted.py	2013-06-21 02:35:32 +0000
@@ -12,7 +12,7 @@
 
 from lp.registry.interfaces.series import SeriesStatus
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.log.logger import BufferLogger
 from lp.services.scripts.base import LaunchpadScriptFailure
 from lp.soyuz.enums import (

=== modified file 'lib/lp/soyuz/tests/test_processor.py'
--- lib/lp/soyuz/tests/test_processor.py	2012-09-28 06:25:44 +0000
+++ lib/lp/soyuz/tests/test_processor.py	2013-06-21 02:35:32 +0000
@@ -5,11 +5,7 @@
 
 from zope.component import getUtility
 
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.soyuz.interfaces.processor import (
     IProcessor,
     IProcessorFamily,
@@ -17,6 +13,7 @@
     IProcessorSet,
     ProcessorNotFound,
     )
+from lp.soyuz.model.processor import Processor
 from lp.testing import (
     ExpectedException,
     logout,
@@ -78,7 +75,7 @@
     def test_getAll(self):
         processor_set = getUtility(IProcessorSet)
         # Make it easy to filter out sample data
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(Processor)
         store.execute("UPDATE Processor SET name = 'sample_data_' || name")
         self.factory.makeProcessorFamily(name='q1')
         self.factory.makeProcessorFamily(name='i686')
@@ -109,7 +106,7 @@
 
     def test_default_collection(self):
         # Make it easy to filter out sample data
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(Processor)
         store.execute("UPDATE Processor SET name = 'sample_data_' || name")
         self.factory.makeProcessorFamily(name='q1')
         self.factory.makeProcessorFamily(name='i686')

=== modified file 'lib/lp/systemhomes.py'
--- lib/lp/systemhomes.py	2013-04-09 11:51:24 +0000
+++ lib/lp/systemhomes.py	2013-06-21 02:35:32 +0000
@@ -60,7 +60,7 @@
 from lp.registry.interfaces.mailinglist import IMailingListApplication
 from lp.registry.interfaces.product import IProductSet
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.feeds.interfaces.application import IFeedsApplication
 from lp.services.statistics.interfaces.statistic import ILaunchpadStatisticSet
 from lp.services.webapp.interfaces import (

=== modified file 'lib/lp/testing/factory.py'
--- lib/lp/testing/factory.py	2013-05-24 03:05:34 +0000
+++ lib/lp/testing/factory.py	2013-06-21 02:35:32 +0000
@@ -221,13 +221,9 @@
     UTC_NOW,
     )
 from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
-from lp.services.database.lpstorm import (
     IMasterStore,
     IStore,
+    IStoreSelector,
     )
 from lp.services.database.policy import MasterDatabasePolicy
 from lp.services.database.sqlbase import flush_database_updates
@@ -2894,13 +2890,12 @@
                 sourcename=sourcename)
         recipe_build_job = recipe_build.makeJob()
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         bq = BuildQueue(
             job=recipe_build_job.job, lastscore=score,
             job_type=BuildFarmJobType.RECIPEBRANCHBUILD,
             estimated_duration=timedelta(seconds=estimated_duration),
             virtualized=virtualized)
-        store.add(bq)
+        IStore(BuildQueue).add(bq)
         return bq
 
     def makeTranslationTemplatesBuildJob(self, branch=None):

=== modified file 'lib/lp/testing/fixture.py'
--- lib/lp/testing/fixture.py	2012-09-28 06:25:44 +0000
+++ lib/lp/testing/fixture.py	2013-06-21 02:35:32 +0000
@@ -41,7 +41,6 @@
 from zope.component import (
     adapter,
     getGlobalSiteManager,
-    getUtility,
     provideHandler,
     )
 from zope.interface import Interface
@@ -54,11 +53,8 @@
 
 from lp.services import webapp
 from lp.services.config import config
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
+from lp.services.librarian.model import LibraryFileAlias
 from lp.services.messaging.interfaces import MessagingUnavailable
 from lp.services.messaging.rabbit import connect
 from lp.services.timeline.requesttimeline import get_request_timeline
@@ -407,16 +403,14 @@
         self.addCleanup(self._enable_triggers)
 
     def _process_triggers(self, mode):
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
         with dbuser('postgres'):
             for table, trigger in self.table_triggers.items():
                 sql = ("ALTER TABLE %(table)s %(mode)s trigger "
                        "%(trigger)s") % {
                     'table': table,
                     'mode': mode,
-                    'trigger': trigger,
-                }
-                store.execute(sql)
+                    'trigger': trigger}
+                IStore(LibraryFileAlias).execute(sql)
 
     def _disable_triggers(self):
         self._process_triggers(mode='DISABLE')

=== modified file 'lib/lp/testing/layers.py'
--- lib/lp/testing/layers.py	2013-05-15 04:41:33 +0000
+++ lib/lp/testing/layers.py	2013-06-21 02:35:32 +0000
@@ -110,16 +110,13 @@
     ConfigFixture,
     ConfigUseFixture,
     )
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import session_store
 from lp.services.googlesearch.tests.googleserviceharness import (
     GoogleServiceTestSetup,
     )
 from lp.services.job.tests import celeryd
+from lp.services.librarian.model import LibraryFileAlias
 from lp.services.librarianserver.testing.server import LibrarianServerFixture
 from lp.services.mail.mailbox import (
     IMailBox,
@@ -221,7 +218,7 @@
     if reset:
         dbconfig.reset()
 
-    main_store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+    main_store = IStore(LibraryFileAlias)
     assert main_store is not None, 'Failed to reconnect'
 
     # Confirm that SQLOS is again talking to the database (it connects

=== modified file 'lib/lp/testing/librarianhelpers.py'
--- lib/lp/testing/librarianhelpers.py	2012-09-28 06:25:44 +0000
+++ lib/lp/testing/librarianhelpers.py	2013-06-21 02:35:32 +0000
@@ -11,11 +11,7 @@
 from storm.expr import Desc
 from zope.component import getUtility
 
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.librarian.interfaces.client import ILibrarianClient
 from lp.services.librarian.model import LibraryFileAlias
 
@@ -28,7 +24,6 @@
 
     :return: A file-like object of the file content.
     """
-    store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-    alias = store.find(LibraryFileAlias).order_by(
+    alias = IStore(LibraryFileAlias).find(LibraryFileAlias).order_by(
         Desc(LibraryFileAlias.date_created)).first()
     return getUtility(ILibrarianClient).getFileByAlias(alias.id)

=== modified file 'lib/lp/testing/tests/test_dbuser.py'
--- lib/lp/testing/tests/test_dbuser.py	2012-01-20 16:11:11 +0000
+++ lib/lp/testing/tests/test_dbuser.py	2013-06-21 02:35:32 +0000
@@ -7,7 +7,7 @@
 
 from lp.registry.model.person import Person
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 # or TestCaseWithFactory
 from lp.testing import TestCase
 from lp.testing.dbuser import (

=== modified file 'lib/lp/testing/tests/test_factory.py'
--- lib/lp/testing/tests/test_factory.py	2013-04-16 21:54:05 +0000
+++ lib/lp/testing/tests/test_factory.py	2013-06-21 02:35:32 +0000
@@ -25,7 +25,7 @@
 from lp.registry.interfaces.distroseries import IDistroSeries
 from lp.registry.interfaces.sourcepackage import SourcePackageFileType
 from lp.registry.interfaces.suitesourcepackage import ISuiteSourcePackage
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.webapp.interfaces import ILaunchBag
 from lp.services.worlddata.interfaces.language import ILanguage
 from lp.soyuz.enums import (

=== modified file 'lib/lp/testing/tests/test_fixture.py'
--- lib/lp/testing/tests/test_fixture.py	2012-09-05 11:05:40 +0000
+++ lib/lp/testing/tests/test_fixture.py	2013-06-21 02:35:32 +0000
@@ -28,7 +28,7 @@
     config,
     dbconfig,
     )
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.messaging import rabbit
 from lp.services.webapp.errorlog import (
     globalErrorUtility,

=== modified file 'lib/lp/testing/tests/test_layers_functional.py'
--- lib/lp/testing/tests/test_layers_functional.py	2012-01-02 22:29:12 +0000
+++ lib/lp/testing/tests/test_layers_functional.py	2013-06-21 02:35:32 +0000
@@ -233,7 +233,9 @@
                     want_librarian_working,
                     'Librarian should be fully operational'
                     )
-        except (AttributeError, ComponentLookupError):
+        # Since we use IMasterStore that doesn't throw either AttributeError
+        # or ComponentLookupError.
+        except TypeError:
             self.failIf(
                     want_librarian_working,
                     'Librarian not operational as component architecture '

=== modified file 'lib/lp/translations/browser/tests/test_baseexportview.py'
--- lib/lp/translations/browser/tests/test_baseexportview.py	2012-01-01 02:58:52 +0000
+++ lib/lp/translations/browser/tests/test_baseexportview.py	2013-06-21 02:35:32 +0000
@@ -8,7 +8,7 @@
 
 import transaction
 
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.webapp.servers import LaunchpadTestRequest
 from lp.testing import TestCaseWithFactory
 from lp.testing.layers import ZopelessDatabaseLayer

=== modified file 'lib/lp/translations/browser/tests/test_poexportrequest_views.py'
--- lib/lp/translations/browser/tests/test_poexportrequest_views.py	2012-01-01 02:58:52 +0000
+++ lib/lp/translations/browser/tests/test_poexportrequest_views.py	2013-06-21 02:35:32 +0000
@@ -5,7 +5,7 @@
 
 from zope.security.proxy import removeSecurityProxy
 
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.webapp.servers import LaunchpadTestRequest
 from lp.testing import (
     login_person,

=== modified file 'lib/lp/translations/doc/poexportqueue-replication-lag.txt'
--- lib/lp/translations/doc/poexportqueue-replication-lag.txt	2011-12-21 14:58:31 +0000
+++ lib/lp/translations/doc/poexportqueue-replication-lag.txt	2013-06-21 02:35:32 +0000
@@ -6,10 +6,9 @@
 
 We start our story with an empty export queue.
 
-    >>> from datetime import timedelta
     >>> import transaction
     >>> from zope.component import getUtility
-    >>> from lp.services.database.lpstorm import IMasterStore
+    >>> from lp.services.database.interfaces import IMasterStore
     >>> from lp.translations.interfaces.poexportrequest import (
     ...     IPOExportRequestSet)
     >>> from lp.translations.interfaces.pofile import IPOFile

=== modified file 'lib/lp/translations/doc/translationimportqueue.txt'
--- lib/lp/translations/doc/translationimportqueue.txt	2012-11-21 17:18:19 +0000
+++ lib/lp/translations/doc/translationimportqueue.txt	2013-06-21 02:35:32 +0000
@@ -5,7 +5,7 @@
 into Rosetta.
 
     >>> from zope.security.proxy import removeSecurityProxy
-    >>> from lp.services.database.lpstorm import IStore
+    >>> from lp.services.database.interfaces import IStore
     >>> from lp.registry.interfaces.distroseries import IDistroSeries
     >>> from lp.translations.interfaces.translationimportqueue import (
     ...     ITranslationImportQueue)

=== modified file 'lib/lp/translations/model/customlanguagecode.py'
--- lib/lp/translations/model/customlanguagecode.py	2011-12-30 06:14:56 +0000
+++ lib/lp/translations/model/customlanguagecode.py	2013-06-21 02:35:32 +0000
@@ -18,7 +18,7 @@
 from storm.expr import And
 from zope.interface import implements
 
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import SQLBase
 from lp.translations.interfaces.customlanguagecode import ICustomLanguageCode
 

=== modified file 'lib/lp/translations/model/poexportrequest.py'
--- lib/lp/translations/model/poexportrequest.py	2013-01-07 02:40:55 +0000
+++ lib/lp/translations/model/poexportrequest.py	2013-06-21 02:35:32 +0000
@@ -9,7 +9,6 @@
     ]
 
 from sqlobject import ForeignKey
-from zope.component import getUtility
 from zope.interface import implements
 
 from lp.registry.interfaces.person import validate_public_person
@@ -17,14 +16,9 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
 from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    )
-from lp.services.database.lpstorm import (
     IMasterStore,
     ISlaveStore,
+    IStore,
     )
 from lp.services.database.sqlbase import (
     quote,
@@ -47,12 +41,10 @@
     @property
     def entry_count(self):
         """See `IPOExportRequestSet`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find(POExportRequest, True).count()
+        return IStore(POExportRequest).find(POExportRequest, True).count()
 
     def estimateBacklog(self):
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        row = store.execute(
+        row = IStore(POExportRequest).execute(
             "SELECT now() - min(date_created) FROM POExportRequest").get_one()
         if row is None:
             return None
@@ -87,7 +79,7 @@
             'pofiles': pofile_ids,
             }
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        store = IMasterStore(POExportRequest)
 
         if potemplates:
             # Create requests for all these templates, insofar as the same
@@ -204,4 +196,3 @@
     pofile = ForeignKey(dbName='pofile', foreignKey='POFile')
     format = EnumCol(dbName='format', schema=TranslationFileFormat,
         default=TranslationFileFormat.PO, notNull=True)
-

=== modified file 'lib/lp/translations/model/pofile.py'
--- lib/lp/translations/model/pofile.py	2013-03-28 05:06:19 +0000
+++ lib/lp/translations/model/pofile.py	2013-06-21 02:35:32 +0000
@@ -50,12 +50,9 @@
 from lp.services.database.constants import UTC_NOW
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
+    IMasterStore,
+    IStore,
     )
-from lp.services.database.lpstorm import IStore
 from lp.services.database.sqlbase import (
     flush_database_updates,
     quote,
@@ -270,8 +267,7 @@
         Orders the result by TranslationTemplateItem.sequence which must
         be among `origin_tables`.
         """
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
-        results = store.using(origin_tables).find(
+        results = IMasterStore(POTMsgSet).using(origin_tables).find(
             POTMsgSet, SQL(query))
         return results.order_by(TranslationTemplateItem.sequence)
 
@@ -1505,7 +1501,7 @@
                 'sourcepackagename and distroseries must be None or not'
                    ' None at the same time.')
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(POFile)
 
         conditions = [
             POFile.path == path,
@@ -1547,7 +1543,6 @@
         # Avoid circular imports.
         from lp.translations.model.potemplate import POTemplate
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
         clauses = [
             TranslationTemplateItem.potemplateID == POFile.potemplateID,
             POTMsgSet.id == TranslationTemplateItem.potmsgsetID,
@@ -1571,7 +1566,7 @@
                 (TranslationMessage))
             clauses.append(POTemplate.id == POFile.potemplateID)
             clauses.append(Not(Exists(message_select)))
-        result = store.find((POFile, POTMsgSet), clauses)
+        result = IMasterStore(POFile).find((POFile, POTMsgSet), clauses)
         return result.order_by('POFile.id')
 
     def getPOFilesTouchedSince(self, date):
@@ -1581,7 +1576,7 @@
         from lp.registry.model.distroseries import DistroSeries
         from lp.registry.model.productseries import ProductSeries
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        store = IMasterStore(POTemplate)
 
         # Find a matching POTemplate and its ProductSeries
         # and DistroSeries, if they are defined.

=== modified file 'lib/lp/translations/model/pofilestatsjob.py'
--- lib/lp/translations/model/pofilestatsjob.py	2012-09-28 06:25:44 +0000
+++ lib/lp/translations/model/pofilestatsjob.py	2013-06-21 02:35:32 +0000
@@ -25,11 +25,7 @@
     )
 
 from lp.services.config import config
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.database.stormbase import StormBase
 from lp.services.job.interfaces.job import IRunnableJob
 from lp.services.job.model.job import Job
@@ -98,8 +94,7 @@
     @staticmethod
     def iterReady():
         """See `IJobSource`."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        return store.find((POFileStatsJob),
+        return IStore(POFileStatsJob).find((POFileStatsJob),
             And(POFileStatsJob.job == Job.id,
                 Job.id.is_in(Job.ready_jobs)))
 

=== modified file 'lib/lp/translations/model/potemplate.py'
--- lib/lp/translations/model/potemplate.py	2013-05-02 00:40:14 +0000
+++ lib/lp/translations/model/potemplate.py	2013-06-21 02:35:32 +0000
@@ -60,7 +60,7 @@
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/translations/model/potmsgset.py'
--- lib/lp/translations/model/potmsgset.py	2013-01-07 02:40:55 +0000
+++ lib/lp/translations/model/potmsgset.py	2013-06-21 02:35:32 +0000
@@ -36,7 +36,7 @@
 from lp.app.interfaces.launchpad import ILaunchpadCelebrities
 from lp.services.config import config
 from lp.services.database.constants import DEFAULT
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     cursor,
     quote,

=== modified file 'lib/lp/translations/model/translationgroup.py'
--- lib/lp/translations/model/translationgroup.py	2013-01-07 02:40:55 +0000
+++ lib/lp/translations/model/translationgroup.py	2013-06-21 02:35:32 +0000
@@ -30,7 +30,7 @@
 from lp.services.database.constants import DEFAULT
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.decoratedresultset import DecoratedResultSet
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     ISlaveStore,
     IStore,
     )

=== modified file 'lib/lp/translations/model/translationimportqueue.py'
--- lib/lp/translations/model/translationimportqueue.py	2013-01-07 02:40:55 +0000
+++ lib/lp/translations/model/translationimportqueue.py	2013-06-21 02:35:32 +0000
@@ -60,7 +60,7 @@
     )
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     ISlaveStore,
     IStore,

=== modified file 'lib/lp/translations/model/translationmessage.py'
--- lib/lp/translations/model/translationmessage.py	2011-12-30 06:14:56 +0000
+++ lib/lp/translations/model/translationmessage.py	2013-06-21 02:35:32 +0000
@@ -31,7 +31,7 @@
     )
 from lp.services.database.datetimecol import UtcDateTimeCol
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     quote,
     SQLBase,

=== modified file 'lib/lp/translations/model/translationpolicy.py'
--- lib/lp/translations/model/translationpolicy.py	2012-01-01 02:58:52 +0000
+++ lib/lp/translations/model/translationpolicy.py	2013-06-21 02:35:32 +0000
@@ -16,7 +16,7 @@
 
 from lp.app.interfaces.launchpad import ILaunchpadCelebrities
 from lp.registry.model.person import Person
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.translations.enums import TranslationPermission
 from lp.translations.interfaces.translationsperson import ITranslationsPerson
 from lp.translations.model.translationgroup import TranslationGroup

=== modified file 'lib/lp/translations/model/translationsharingjob.py'
--- lib/lp/translations/model/translationsharingjob.py	2012-04-26 19:42:04 +0000
+++ lib/lp/translations/model/translationsharingjob.py	2013-06-21 02:35:32 +0000
@@ -25,7 +25,7 @@
 from lp.registry.model.productseries import ProductSeries
 from lp.registry.model.sourcepackagename import SourcePackageName
 from lp.services.database.enumcol import EnumCol
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.stormbase import StormBase
 from lp.services.job.interfaces.job import (
     IJob,

=== modified file 'lib/lp/translations/model/translationtemplatesbuild.py'
--- lib/lp/translations/model/translationtemplatesbuild.py	2013-02-04 06:14:32 +0000
+++ lib/lp/translations/model/translationtemplatesbuild.py	2013-06-21 02:35:32 +0000
@@ -39,7 +39,7 @@
 from lp.services.database.bulk import load_related
 from lp.services.database.decoratedresultset import DecoratedResultSet
 from lp.services.database.enumcol import DBEnum
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.translations.interfaces.translationtemplatesbuild import (
     ITranslationTemplatesBuild,
     ITranslationTemplatesBuildSource,

=== modified file 'lib/lp/translations/model/translationtemplatesbuildjob.py'
--- lib/lp/translations/model/translationtemplatesbuildjob.py	2013-01-29 04:43:50 +0000
+++ lib/lp/translations/model/translationtemplatesbuildjob.py	2013-06-21 02:35:32 +0000
@@ -32,7 +32,7 @@
     )
 from lp.services.config import config
 from lp.services.database.bulk import load_related
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     IMasterStore,
     IStore,
     )

=== modified file 'lib/lp/translations/model/vpoexport.py'
--- lib/lp/translations/model/vpoexport.py	2013-01-07 02:40:55 +0000
+++ lib/lp/translations/model/vpoexport.py	2013-06-21 02:35:32 +0000
@@ -14,14 +14,9 @@
     And,
     Or,
     )
-from zope.component import getUtility
 from zope.interface import implements
 
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    SLAVE_FLAVOR,
-    )
+from lp.services.database.interfaces import ISlaveStore
 from lp.soyuz.model.component import Component
 from lp.soyuz.model.publishing import SourcePackagePublishingHistory
 from lp.translations.interfaces.vpoexport import (
@@ -81,8 +76,8 @@
         # Use the slave store.  We may want to write to the distroseries
         # to register a language pack, but not to the translation data
         # we retrieve for it.
-        store = getUtility(IStoreSelector).get(MAIN_STORE, SLAVE_FLAVOR)
-        query = store.using(*tables).find(POFile, And(*conditions))
+        query = ISlaveStore(POFile).using(*tables).find(
+            POFile, And(*conditions))
 
         # Order by POTemplate.  Caching in the export scripts can be
         # much more effective when consecutive POFiles belong to the

=== modified file 'lib/lp/translations/scripts/migrate_current_flag.py'
--- lib/lp/translations/scripts/migrate_current_flag.py	2012-09-28 06:25:44 +0000
+++ lib/lp/translations/scripts/migrate_current_flag.py	2013-06-21 02:35:32 +0000
@@ -15,16 +15,11 @@
     Select,
     )
 from storm.info import ClassAlias
-from zope.component import getUtility
 from zope.interface import implements
 
 from lp.registry.model.product import Product
 from lp.registry.model.productseries import ProductSeries
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    )
+from lp.services.database.interfaces import IMasterStore
 from lp.services.looptuner import (
     DBLoopTuner,
     ITunableLoop,
@@ -49,7 +44,7 @@
         self.total = len(self.tm_ids)
         self.logger.info(
             "Fixing up a total of %d TranslationMessages." % (self.total))
-        self.store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        self.store = IMasterStore(Product)
 
     def isDone(self):
         """See `ITunableLoop`."""
@@ -125,7 +120,7 @@
         self.logger = logger
         if logger is None:
             self.logger = logging.getLogger("migrate-current-flag")
-        self.store = getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
+        self.store = IMasterStore(Product)
 
     def getProductsWithTemplates(self):
         """Get Product.ids for projects with any translations templates."""

=== modified file 'lib/lp/translations/scripts/scrub_pofiletranslator.py'
--- lib/lp/translations/scripts/scrub_pofiletranslator.py	2012-05-09 11:31:57 +0000
+++ lib/lp/translations/scripts/scrub_pofiletranslator.py	2013-06-21 02:35:32 +0000
@@ -24,7 +24,7 @@
     load,
     load_related,
     )
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.looptuner import TunableLoop
 from lp.services.worlddata.model.language import Language
 from lp.translations.model.pofile import POFile

=== modified file 'lib/lp/translations/scripts/tests/test_cache_suggestive_templates.py'
--- lib/lp/translations/scripts/tests/test_cache_suggestive_templates.py	2012-09-28 06:25:44 +0000
+++ lib/lp/translations/scripts/tests/test_cache_suggestive_templates.py	2013-06-21 02:35:32 +0000
@@ -8,14 +8,11 @@
 from zope.component import getUtility
 
 from lp.app.enums import ServiceUsage
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.testing import TestCaseWithFactory
 from lp.testing.layers import ZopelessDatabaseLayer
 from lp.translations.interfaces.potemplate import IPOTemplateSet
+from lp.translations.model.pofile import POFile
 
 
 class TestSuggestivePOTemplatesCache(TestCaseWithFactory):
@@ -32,8 +29,7 @@
 
     def _readCache(self):
         """Read cache contents, in deterministic order."""
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
-        result = store.execute(
+        result = IStore(POFile).execute(
             "SELECT * FROM SuggestivePOTemplate ORDER BY potemplate")
         return [id for id, in result.get_all()]
 

=== modified file 'lib/lp/translations/scripts/tests/test_scrub_pofiletranslator.py'
--- lib/lp/translations/scripts/tests/test_scrub_pofiletranslator.py	2012-05-09 11:38:37 +0000
+++ lib/lp/translations/scripts/tests/test_scrub_pofiletranslator.py	2013-06-21 02:35:32 +0000
@@ -14,7 +14,7 @@
 import transaction
 
 from lp.services.database.constants import UTC_NOW
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.log.logger import DevNullLogger
 from lp.testing import TestCaseWithFactory
 from lp.testing.layers import ZopelessDatabaseLayer

=== modified file 'lib/lp/translations/scripts/tests/test_translations_to_branch.py'
--- lib/lp/translations/scripts/tests/test_translations_to_branch.py	2012-01-01 02:58:52 +0000
+++ lib/lp/translations/scripts/tests/test_translations_to_branch.py	2013-06-21 02:35:32 +0000
@@ -21,7 +21,7 @@
     )
 from lp.registry.model.productseries import ProductSeries
 from lp.services.config import config
-from lp.services.database.lpstorm import ISlaveStore
+from lp.services.database.interfaces import ISlaveStore
 from lp.services.log.logger import BufferLogger
 from lp.services.scripts.tests import run_script
 from lp.testing import (

=== modified file 'lib/lp/translations/scripts/translations_to_branch.py'
--- lib/lp/translations/scripts/translations_to_branch.py	2012-09-28 06:25:44 +0000
+++ lib/lp/translations/scripts/translations_to_branch.py	2013-06-21 02:35:32 +0000
@@ -38,11 +38,9 @@
 from lp.codehosting.vfs import get_rw_server
 from lp.services.config import config
 from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    SLAVE_FLAVOR,
+    IMasterStore,
+    ISlaveStore,
     )
-from lp.services.database.lpstorm import IMasterStore
 from lp.services.helpers import shortlist
 from lp.services.mail.helpers import (
     get_contact_email_addresses,
@@ -316,7 +314,7 @@
 
         self.logger.info("Exporting to translations branches.")
 
-        self.store = getUtility(IStoreSelector).get(MAIN_STORE, SLAVE_FLAVOR)
+        self.store = ISlaveStore(Product)
 
         product_join = Join(
             ProductSeries, Product, ProductSeries.product == Product.id)

=== modified file 'lib/lp/translations/tests/test_autoapproval.py'
--- lib/lp/translations/tests/test_autoapproval.py	2012-12-26 01:32:19 +0000
+++ lib/lp/translations/tests/test_autoapproval.py	2013-06-21 02:35:32 +0000
@@ -26,7 +26,7 @@
     SourcePackageName,
     SourcePackageNameSet,
     )
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.worlddata.model.language import (
     Language,
     LanguageSet,

=== modified file 'lib/lp/translations/tests/test_translationimportqueue.py'
--- lib/lp/translations/tests/test_translationimportqueue.py	2012-11-21 17:03:43 +0000
+++ lib/lp/translations/tests/test_translationimportqueue.py	2013-06-21 02:35:32 +0000
@@ -12,7 +12,7 @@
 
 from lp.app.enums import InformationType
 from lp.app.interfaces.launchpad import ILaunchpadCelebrities
-from lp.services.database.lpstorm import (
+from lp.services.database.interfaces import (
     ISlaveStore,
     IStore,
     )

=== modified file 'lib/lp/translations/tests/test_translationtemplatesbuildjob.py'
--- lib/lp/translations/tests/test_translationtemplatesbuildjob.py	2012-12-26 01:32:19 +0000
+++ lib/lp/translations/tests/test_translationtemplatesbuildjob.py	2013-06-21 02:35:32 +0000
@@ -18,11 +18,7 @@
 from lp.code.model.branchjob import BranchJob
 from lp.code.model.directbranchcommit import DirectBranchCommit
 from lp.codehosting.scanner import events
-from lp.services.database.interfaces import (
-    DEFAULT_FLAVOR,
-    IStoreSelector,
-    MAIN_STORE,
-    )
+from lp.services.database.interfaces import IStore
 from lp.services.job.model.job import Job
 from lp.testing import (
     TestCaseWithFactory,
@@ -277,7 +273,7 @@
 
         self.jobsource.scheduleTranslationTemplatesBuild(branch)
 
-        store = getUtility(IStoreSelector).get(MAIN_STORE, DEFAULT_FLAVOR)
+        store = IStore(BranchJob)
         branchjobs = list(store.find(BranchJob, BranchJob.branch == branch))
         self.assertEqual(1, len(branchjobs))
         self.assertEqual(branch, branchjobs[0].branch)

=== modified file 'lib/lp/translations/translationmerger.py'
--- lib/lp/translations/translationmerger.py	2012-05-04 09:11:12 +0000
+++ lib/lp/translations/translationmerger.py	2013-06-21 02:35:32 +0000
@@ -23,7 +23,7 @@
 from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
 from lp.registry.model.distroseries import DistroSeries
 from lp.registry.model.packaging import Packaging
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.orderingcheck import OrderingCheck
 from lp.services.scripts.base import (
     LaunchpadScript,

=== modified file 'lib/lp/translations/utilities/translation_import.py'
--- lib/lp/translations/utilities/translation_import.py	2012-11-15 14:28:02 +0000
+++ lib/lp/translations/utilities/translation_import.py	2013-06-21 02:35:32 +0000
@@ -25,7 +25,7 @@
     )
 from lp.registry.interfaces.sourcepackage import ISourcePackageFactory
 from lp.services.config import config
-from lp.services.database.lpstorm import IStore
+from lp.services.database.interfaces import IStore
 from lp.services.database.sqlbase import (
     cursor,
     quote,

=== modified file 'scripts/fix-translations-opening.py'
--- scripts/fix-translations-opening.py	2013-03-25 23:39:42 +0000
+++ scripts/fix-translations-opening.py	2013-06-21 02:35:32 +0000
@@ -12,7 +12,7 @@
 
 from lp.registry.interfaces.distribution import IDistributionSet
 from lp.registry.model.distroseries import DistroSeries
-from lp.services.database.lpstorm import IMasterStore
+from lp.services.database.interfaces import IMasterStore
 from lp.services.looptuner import (
     DBLoopTuner,
     ITunableLoop,

=== modified file 'scripts/get-stacked-on-branches.py'
--- scripts/get-stacked-on-branches.py	2013-01-07 02:40:55 +0000
+++ scripts/get-stacked-on-branches.py	2013-06-21 02:35:32 +0000
@@ -28,13 +28,8 @@
 from optparse import OptionParser
 
 from storm.locals import Not
-from zope.component import getUtility
 
-from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    SLAVE_FLAVOR,
-    )
+from lp.services.database.interfaces import ISlaveStore
 from lp.services.scripts import execute_zcml_for_scripts
 
 
@@ -42,8 +37,7 @@
     """Iterate over all branches that, according to the db, are stacked."""
     # Avoiding circular import.
     from lp.code.model.branch import Branch
-    store = getUtility(IStoreSelector).get(MAIN_STORE, SLAVE_FLAVOR)
-    return store.find(Branch, Not(Branch.stacked_on == None))
+    return ISlaveStore(Branch).find(Branch, Not(Branch.stacked_on == None))
 
 
 def main():

=== modified file 'utilities/soyuz-sampledata-setup.py'
--- utilities/soyuz-sampledata-setup.py	2013-03-12 01:07:49 +0000
+++ utilities/soyuz-sampledata-setup.py	2013-06-21 02:35:32 +0000
@@ -40,10 +40,8 @@
 from lp.registry.interfaces.series import SeriesStatus
 from lp.registry.model.codeofconduct import SignedCodeOfConduct
 from lp.services.database.interfaces import (
-    IStoreSelector,
-    MAIN_STORE,
-    MASTER_FLAVOR,
-    SLAVE_FLAVOR,
+    IMasterStore,
+    ISlaveStore,
     )
 from lp.services.scripts.base import LaunchpadScript
 from lp.soyuz.enums import SourcePackageFormat
@@ -76,18 +74,13 @@
         return max_id[0]
 
 
-def get_store(flavor=MASTER_FLAVOR):
-    """Obtain an ORM store."""
-    return getUtility(IStoreSelector).get(MAIN_STORE, flavor)
-
-
 def check_preconditions(options):
     """Try to ensure that it's safe to run.
 
     This script must not run on a production server, or anything
     remotely like it.
     """
-    store = get_store(SLAVE_FLAVOR)
+    store = ISlaveStore(ComponentSelection)
 
     # Just a guess, but dev systems aren't likely to have ids this high
     # in this table.  Production data does.
@@ -153,13 +146,12 @@
     # Avoid circular import.
     from lp.soyuz.model.distroarchseries import DistroArchSeries
 
-    store = get_store(MASTER_FLAVOR)
     family = getUtility(IProcessorFamilySet).getByName(architecture_name)
     archseries = DistroArchSeries(
         distroseries=distroseries, processorfamily=family,
         owner=distroseries.owner, official=True,
         architecturetag=architecture_name)
-    store.add(archseries)
+    IMasterStore(DistroArchSeries).add(archseries)
 
 
 def create_sections(distroseries):
@@ -253,9 +245,8 @@
 def add_series_component(series):
     """Permit a component in the given series."""
     component = getUtility(IComponentSet)['main']
-    get_store(MASTER_FLAVOR).add(
-        ComponentSelection(
-            distroseries=series, component=component))
+    IMasterStore(ComponentSelection).add(
+        ComponentSelection(distroseries=series, component=component))
 
 
 def clean_up(distribution, log):


Follow ups