launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01845
[Merge] lp:~jml/launchpad/database-apocalypse into lp:launchpad/devel
Jonathan Lange has proposed merging lp:~jml/launchpad/database-apocalypse into lp:launchpad/devel with lp:~jml/launchpad/circular-rage as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This branch builds on the work in circular-rage to remove all of the re-imports from canonical.launchpad.database.
It changes every remaining import like 'from canonical.launchpad.database import Foo' to import from the real module directly. It then deletes the contents of lib/canonical/launchpad/database/__init__.py and replaces it with a docstring.
In the process, I've deleted some files that looked obsolete, notably in database/schema/pending. I also deleted a useless test from c.l.database.tests and merged c.l.database.ftests into tests.
--
https://code.launchpad.net/~jml/launchpad/database-apocalypse/+merge/40253
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jml/launchpad/database-apocalypse into lp:launchpad/devel.
=== removed file 'database/schema/pending/carlos-fix-duplicated-submissions.py'
--- database/schema/pending/carlos-fix-duplicated-submissions.py 2009-06-24 21:17:33 +0000
+++ database/schema/pending/carlos-fix-duplicated-submissions.py 1970-01-01 00:00:00 +0000
@@ -1,180 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2009 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-import sys
-from optparse import OptionParser
-
-from canonical.config import config
-from canonical.lp import initZopeless
-from canonical.database.sqlbase import cursor
-from canonical.launchpad.scripts import (
- execute_zcml_for_scripts, logger, logger_options)
-from canonical.launchpad.database import POFile
-
-POMSGSETID = 0
-POSELECTIONID = 1
-ACTIVESUBMISSION = 2
-PUBLISHEDSUBMISSION = 3
-PLURALFORM = 4
-POSUBMISSIONID = 5
-POTRANSLATION = 6
-LATESTSUBMISSION = 7
-
-def parse_options(args):
- """Parse a set of command line options.
-
- Return an optparse.Values object.
- """
- parser = OptionParser()
-
- parser.add_option("-c", "--check", dest="check",
- default=False,
- action='store_true',
- help=("Whether the script should only check if there are duplicated"
- "entries.")
- )
-
- # Add the verbose/quiet options.
- logger_options(parser)
-
- (options, args) = parser.parse_args(args)
-
- return options
-
-def main(argv):
- options = parse_options(argv[1:])
-
- # Get the global logger for this task.
- logger_object = logger(options, 'rosetta-poimport')
-
- if options.check:
- logger_object.info('Starting the checking process.')
- else:
- logger_object.info('Starting the fixing process.')
-
- # Setup zcml machinery to be able to use getUtility
- execute_zcml_for_scripts()
- ztm = initZopeless(dbuser=config.rosettaadmin.dbuser)
-
- # Get the list of POFiles.
- cur = cursor()
- cur.execute("SELECT id FROM POFile")
- pofile_ids = cur.fetchall()
- pofile_ids = [set_entry[0] for set_entry in pofile_ids]
-
- duplicates_found = 0
- processed = 0
- for pofileid in pofile_ids:
- # Get all its POMsgSet entries.
- cur = cursor()
- cur.execute("""
- SELECT
- POMsgSet.id,
- POSelection.id,
- POSelection.activesubmission,
- POSelection.publishedsubmission,
- POSelection.pluralform,
- POSubmission.id,
- POSubmission.potranslation,
- POFile.latestsubmission
- FROM
- POFile
- JOIN POMsgSet ON POMsgSet.pofile = POFile.id
- JOIN POSubmission ON POSubmission.pomsgset = POMsgSet.id
- LEFT OUTER JOIN POSelection ON
- POSelection.pomsgset = POMsgSet.id AND
- POSelection.pluralform = POSubmission.pluralform
- WHERE POFile.id = %d
- ORDER BY
- POMsgSet.id, POSubmission.pluralform,
- POSubmission.potranslation, POSubmission.datecreated;
- """ % pofileid)
-
- rows = cur.fetchall()
- current_pomsgset = None
- needs_recalculate = False
- duplicated_ids = []
- for row in rows:
- if current_pomsgset != row[POMSGSETID]:
- # It's a new POMsgSet
- current_pomsgset = row[POMSGSETID]
- current_pluralform = None
- if current_pluralform != row[PLURALFORM]:
- current_pluralform = row[PLURALFORM]
- current_translation = None
- current_posubmission = None
- if current_translation != row[POTRANSLATION]:
- current_translation = row[POTRANSLATION]
- current_posubmission = row[POSUBMISSIONID]
- else:
- # This submission is a duplicate of current_posubmission
- # because the translations are the same, and we should have
- # just one posubmission for a given translation.
- duplicated_ids.append(row[POSUBMISSIONID])
- duplicates_found += 1
-
- if options.check:
- # We are only checking, don't execute the write
- # operations.
- continue
-
- if row[ACTIVESUBMISSION] == row[POSUBMISSIONID]:
- # We need to remove this reference to the submission we
- # are going to remove later because it's a duplicate.
- cur = cursor()
- cur.execute("""
- UPDATE POSelection
- SET activesubmission = %d
- WHERE id = %d""" % (
- current_posubmission, row[POSELECTIONID]))
-
- if row[PUBLISHEDSUBMISSION] == row[POSUBMISSIONID]:
- # We need to remove this reference to the submission we
- # are going to remove later because it's a duplicate.
- cur = cursor()
- cur.execute("""
- UPDATE POSelection
- SET publishedsubmission = %d
- WHERE id = %d""" % (
- current_posubmission, row[POSELECTIONID]))
- if row[LATESTSUBMISSION] == row[POSUBMISSIONID]:
- # We need to remove this reference to the submission we
- # are going to remove later because it's a duplicate.
- cur = cursor()
- cur.execute("""
- UPDATE POFile
- SET latestsubmission = NULL
- WHERE id = %d""" % pofileid)
- needs_recalculate = True
- processed += 1
- if processed % 50000 == 0:
- logger_object.info('Processed %d POSubmissions' % processed)
-
- if not options.check:
- for duplicate in duplicated_ids:
- # Remove all duplicates.
- cur = cursor()
- cur.execute(
- "DELETE FROM POSubmission WHERE id = %d" % duplicate)
- if needs_recalculate:
- # We removed the latestsubmission for this
- # entry, we need to recalculate it now that the
- # duplicate entries are removed.
- pofile = POFile.get(pofileid)
- pofile.recalculateLatestSubmission()
- ztm.commit()
-
- if options.check:
- logger_object.info(
- 'Finished the checking process and found %d entries to be fixed'
- ' in %d POSubmissions objects.' % (duplicates_found, processed))
- else:
- logger_object.info(
- 'Finished the fixing process. We fixed %d duplicates in %d'
- ' POSubmissions objects.' % (duplicates_found, processed))
-
-
-if __name__ == '__main__':
- main(sys.argv)
=== removed file 'database/schema/pending/update-shippingrequest-types.py'
--- database/schema/pending/update-shippingrequest-types.py 2010-10-03 15:30:06 +0000
+++ database/schema/pending/update-shippingrequest-types.py 1970-01-01 00:00:00 +0000
@@ -1,51 +0,0 @@
-#!/usr/bin/python -S
-#
-# Copyright 2009 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-# Update the type of all Feisty requests since these are the only ones we can
-# still infer.
-
-import _pythonpath
-
-from canonical.database.sqlbase import cursor, sqlvalues
-from canonical.launchpad.database import ShippingRequest
-from canonical.launchpad.scripts import execute_zcml_for_scripts
-from canonical.lp import initZopeless
-from canonical.launchpad.interfaces import (
- ShipItDistroSeries, ShipItFlavour, ShippingRequestType)
-
-
-execute_zcml_for_scripts()
-ztm = initZopeless(implicitBegin=False)
-
-ztm.begin()
-query = """
- SELECT DISTINCT ShippingRequest.id
- FROM ShippingRequest
- WHERE ShippingRequest.type IS NULL
- AND ShippingRequest.id IN (
- SELECT request FROM RequestedCDs WHERE distrorelease = %s)
- """ % sqlvalues(ShipItDistroSeries.FEISTY)
-cur = cursor()
-cur.execute(query)
-ids = cur.fetchall()
-ztm.abort()
-
-for [id] in ids:
- ztm.begin()
-
- request = ShippingRequest.get(id)
- requested_cds = request.getAllRequestedCDs()
- is_custom = False
- for flavour in ShipItFlavour.items:
- if request.containsCustomQuantitiesOfFlavour(flavour):
- is_custom = True
- if is_custom:
- request.type = ShippingRequestType.CUSTOM
- print "Updated type of request #%d to CUSTOM" % request.id
- else:
- request.type = ShippingRequestType.STANDARD
- print "Updated type of request #%d to STANDARD" % request.id
-
- ztm.commit()
=== modified file 'lib/canonical/database/harness.py'
--- lib/canonical/database/harness.py 2010-10-03 15:30:06 +0000
+++ lib/canonical/database/harness.py 2010-11-06 13:09:51 +0000
@@ -22,23 +22,18 @@
import transaction
from zope.component import getUtility
-from zope.configuration import xmlconfig
from canonical.launchpad.scripts import execute_zcml_for_scripts
-#
-# We don't really depend on everything from canonical.launchpad.database and
-# canonical.launchpad.interfaces, but it's good to have this available in the
-# namespace.
-#
-# pylint: disable-msg=W0614,W0401
-from canonical.launchpad.database import *
-from canonical.launchpad.interfaces import *
+from lp.answers.model.question import Question
+from lp.blueprints.model.specification import Specification
from lp.bugs.model.bug import Bug
+from lp.registry.model.distribution import Distribution
+from lp.registry.model.distroseries import DistroSeries
+from lp.registry.model.person import Person
+from lp.registry.model.product import Product
+from lp.registry.model.projectgroup import ProjectGroup
from lp.testing.factory import LaunchpadObjectFactory
-from lp.testing.mail import create_mail_for_directoryMailBox
-from canonical.launchpad.testing.systemdocs import (
- create_initialized_view, create_view)
from zope.interface.verify import verifyObject
=== modified file 'lib/canonical/launchpad/database/__init__.py'
--- lib/canonical/launchpad/database/__init__.py 2010-11-06 13:09:50 +0000
+++ lib/canonical/launchpad/database/__init__.py 2010-11-06 13:09:51 +0000
@@ -1,14 +1,9 @@
# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
-# pylint: disable-msg=W0401,C0301
+"""Database / model code for bits of Launchpad that don't fit anywhere else.
-from canonical.launchpad.database.account import *
-from canonical.launchpad.database.emailaddress import *
-from canonical.launchpad.database.librarian import *
-from canonical.launchpad.database.logintoken import *
-from canonical.launchpad.database.message import *
-from canonical.launchpad.database.oauth import *
-from canonical.launchpad.database.temporaryblobstorage import *
-from lp.services.worlddata.model.language import *
-from lp.services.worlddata.model.spokenin import *
+DEPRECATED: This package is deprecated. Do not add any new modules to this
+package. Where possible, move things out of this package into better
+locations under the 'lp' package. See the `lp` docstring for more details.
+"""
=== removed directory 'lib/canonical/launchpad/database/ftests'
=== removed file 'lib/canonical/launchpad/database/ftests/__init__.py'
--- lib/canonical/launchpad/database/ftests/__init__.py 2009-06-25 05:39:50 +0000
+++ lib/canonical/launchpad/database/ftests/__init__.py 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-"""Functional tests."""
-
-__metaclass__ = type
=== removed file 'lib/canonical/launchpad/database/tests/test_imports.py'
--- lib/canonical/launchpad/database/tests/test_imports.py 2010-08-20 20:31:18 +0000
+++ lib/canonical/launchpad/database/tests/test_imports.py 1970-01-01 00:00:00 +0000
@@ -1,14 +0,0 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-# Authors : Robert Collins <robert.collins@xxxxxxxxxxxxx>
-# Tests that various database modules can be imported.
-
-import sys
-import unittest
-
-
-def test_suite():
- return unittest.TestLoader().loadTestsFromModule(sys.modules[__name__])
-
-
=== modified file 'lib/canonical/launchpad/database/tests/test_message.py'
--- lib/canonical/launchpad/database/tests/test_message.py 2010-10-04 19:50:45 +0000
+++ lib/canonical/launchpad/database/tests/test_message.py 2010-11-06 13:09:51 +0000
@@ -18,7 +18,7 @@
import transaction
from zope.component import getUtility
-from canonical.launchpad.database import (
+from canonical.launchpad.database.message import (
MessageJob,
MessageJobAction,
MessageSet,
=== renamed file 'lib/canonical/launchpad/database/ftests/test_timelimitedtoken.py' => 'lib/canonical/launchpad/database/tests/test_timelimitedtoken.py'
--- lib/canonical/launchpad/database/ftests/test_timelimitedtoken.py 2010-10-04 19:50:45 +0000
+++ lib/canonical/launchpad/database/tests/test_timelimitedtoken.py 2010-11-06 13:09:51 +0000
@@ -6,7 +6,6 @@
__metaclass__ = type
import testtools
-import transaction
from canonical.database.sqlbase import session_store
from canonical.launchpad.database.librarian import TimeLimitedToken
=== modified file 'lib/canonical/launchpad/doc/batch_navigation.txt'
--- lib/canonical/launchpad/doc/batch_navigation.txt 2010-10-18 22:24:59 +0000
+++ lib/canonical/launchpad/doc/batch_navigation.txt 2010-11-06 13:09:51 +0000
@@ -56,7 +56,7 @@
Imports and initialization:
>>> from canonical.ftests.pgsql import CursorWrapper
- >>> from canonical.launchpad.database import EmailAddress
+ >>> from canonical.launchpad.database.emailaddress import EmailAddress
>>> from canonical.launchpad.interfaces.lpstorm import IStore
>>> ignore = IStore(EmailAddress) # Prime the database connection.
... # (Priming is important if this test is run in isolation).
=== modified file 'lib/canonical/launchpad/doc/librarian.txt'
--- lib/canonical/launchpad/doc/librarian.txt 2010-10-18 22:24:59 +0000
+++ lib/canonical/launchpad/doc/librarian.txt 2010-11-06 13:09:51 +0000
@@ -520,7 +520,7 @@
# Create a new LibraryFileAlias not referencing any LibraryFileContent
# record. Such records are considered as being deleted.
- >>> from canonical.launchpad.database import LibraryFileAlias
+ >>> from canonical.launchpad.database.librarian import LibraryFileAlias
>>> from canonical.launchpad.webapp.interfaces import (
... IStoreSelector, MAIN_STORE, MASTER_FLAVOR)
=== modified file 'lib/canonical/launchpad/doc/storm.txt'
--- lib/canonical/launchpad/doc/storm.txt 2010-10-19 18:44:31 +0000
+++ lib/canonical/launchpad/doc/storm.txt 2010-11-06 13:09:51 +0000
@@ -16,8 +16,11 @@
... ISlaveStore,
... IStore,
... )
- >>> from canonical.launchpad.database import (
- ... Account, AccountPassword, EmailAddress)
+ >>> from canonical.launchpad.database.account import (
+ ... Account,
+ ... AccountPassword,
+ ... )
+ >>> from canonical.launchpad.database.emailaddress import EmailAddress
>>> from zope.security.proxy import ProxyFactory
>>> from lp.registry.interfaces.person import IPersonSet
>>> from lp.registry.model.person import Person
=== modified file 'lib/canonical/launchpad/doc/webapp-publication.txt'
--- lib/canonical/launchpad/doc/webapp-publication.txt 2010-10-18 22:24:59 +0000
+++ lib/canonical/launchpad/doc/webapp-publication.txt 2010-11-06 13:09:51 +0000
@@ -909,7 +909,7 @@
In the default implementation, the following database modification will
be automatically reverted in a GET request.
- >>> from canonical.launchpad.database import EmailAddress
+ >>> from canonical.launchpad.database.emailaddress import EmailAddress
>>> from canonical.launchpad.ftests import syncUpdate
>>> from canonical.launchpad.interfaces.lpstorm import IMasterStore
>>> from lp.registry.model.person import Person
=== modified file 'lib/canonical/launchpad/ftests/test_system_documentation.py'
--- lib/canonical/launchpad/ftests/test_system_documentation.py 2010-10-26 15:48:33 +0000
+++ lib/canonical/launchpad/ftests/test_system_documentation.py 2010-11-06 13:09:51 +0000
@@ -63,7 +63,7 @@
code that did not use the ValidPersonOrTeamCache to determine
validity.
"""
- from canonical.launchpad.database import EmailAddress
+ from canonical.launchpad.database.emailaddress import EmailAddress
from canonical.launchpad.interfaces.emailaddress import EmailAddressStatus
stevea_emailaddress = EmailAddress.byEmail(
'steve.alexander@xxxxxxxxxxxxxxx')
=== modified file 'lib/canonical/launchpad/pagetests/temporaryblobstorage/xx-tempstorage.txt'
--- lib/canonical/launchpad/pagetests/temporaryblobstorage/xx-tempstorage.txt 2010-06-16 07:45:46 +0000
+++ lib/canonical/launchpad/pagetests/temporaryblobstorage/xx-tempstorage.txt 2010-11-06 13:09:51 +0000
@@ -32,7 +32,8 @@
>>> from canonical.launchpad.ftests import login, logout, ANONYMOUS
>>> login(ANONYMOUS)
- >>> from canonical.launchpad.database import TemporaryBlobStorage
+ >>> from canonical.launchpad.database.temporaryblobstorage import (
+ ... TemporaryBlobStorage)
>>> blob = TemporaryBlobStorage.byUuid(ticket)
>>> blob.blob
'abcd\x00efg'
=== modified file 'lib/canonical/launchpad/scripts/ftests/librarianformatter.txt'
--- lib/canonical/launchpad/scripts/ftests/librarianformatter.txt 2010-10-04 19:50:45 +0000
+++ lib/canonical/launchpad/scripts/ftests/librarianformatter.txt 2010-11-06 13:09:51 +0000
@@ -92,7 +92,7 @@
>>> match = re.search('/(\d+)/', url)
>>> alias_id = match.group(1)
->>> from canonical.launchpad.database import LibraryFileAlias
+>>> from canonical.launchpad.database.librarian import LibraryFileAlias
>>> transaction.abort() # To see db changes made by the librarian
>>> alias = LibraryFileAlias.get(alias_id)
>>> now = datetime.now().replace(tzinfo=utc)
=== modified file 'lib/canonical/librarian/client.py'
--- lib/canonical/librarian/client.py 2010-09-10 04:07:04 +0000
+++ lib/canonical/librarian/client.py 2010-11-06 13:09:51 +0000
@@ -126,8 +126,8 @@
name = name.encode('utf-8')
# Import in this method to avoid a circular import
- from canonical.launchpad.database import LibraryFileContent
- from canonical.launchpad.database import LibraryFileAlias
+ from canonical.launchpad.database.librarian import LibraryFileContent
+ from canonical.launchpad.database.librarian import LibraryFileAlias
self._connect()
try:
@@ -314,7 +314,7 @@
:raises: `DownloadFailed` if the alias is invalid or
inaccessible.
"""
- from canonical.launchpad.database import LibraryFileAlias
+ from canonical.launchpad.database.librarian import LibraryFileAlias
from sqlobject import SQLObjectNotFound
try:
lfa = LibraryFileAlias.get(aliasID)
=== modified file 'lib/canonical/librarian/ftests/test_client.py'
--- lib/canonical/librarian/ftests/test_client.py 2010-10-04 19:50:45 +0000
+++ lib/canonical/librarian/ftests/test_client.py 2010-11-06 13:09:51 +0000
@@ -15,7 +15,7 @@
from canonical.librarian.client import (
LibrarianClient, LibrarianServerError, RestrictedLibrarianClient)
from canonical.librarian.interfaces import UploadFailed
-from canonical.launchpad.database import LibraryFileAlias
+from canonical.launchpad.database.librarian import LibraryFileAlias
class InstrumentedLibrarianClient(LibrarianClient):
=== modified file 'lib/canonical/librarian/ftests/test_gc.py'
--- lib/canonical/librarian/ftests/test_gc.py 2010-10-04 19:50:45 +0000
+++ lib/canonical/librarian/ftests/test_gc.py 2010-11-06 13:09:51 +0000
@@ -20,8 +20,14 @@
from canonical.config import config
from canonical.database.sqlbase import (
- connect, cursor, ISOLATION_LEVEL_AUTOCOMMIT)
-from canonical.launchpad.database import LibraryFileAlias, LibraryFileContent
+ connect,
+ cursor,
+ ISOLATION_LEVEL_AUTOCOMMIT,
+ )
+from canonical.launchpad.database.librarian import (
+ LibraryFileAlias,
+ LibraryFileContent,
+ )
from canonical.librarian import librariangc
from canonical.librarian.client import LibrarianClient
from canonical.testing.layers import LaunchpadZopelessLayer
=== modified file 'lib/canonical/librarian/ftests/test_storage.py'
--- lib/canonical/librarian/ftests/test_storage.py 2010-10-04 19:50:45 +0000
+++ lib/canonical/librarian/ftests/test_storage.py 2010-11-06 13:09:51 +0000
@@ -10,7 +10,7 @@
from canonical.librarian.storage import LibraryFileUpload, DuplicateFileIDError
from canonical.librarian import db
from canonical.database.sqlbase import flush_database_updates
-from canonical.launchpad.database import LibraryFileContent, LibraryFileAlias
+from canonical.launchpad.database.librarian import LibraryFileContent
from canonical.testing.layers import LaunchpadZopelessLayer
@@ -37,7 +37,6 @@
def test_addFiles_identical(self):
# Start adding two files with identical data
data = 'data ' * 5000
- digest = hashlib.sha1(data).hexdigest()
newfile1 = self.storage.startAddFile('file1', len(data))
newfile2 = self.storage.startAddFile('file2', len(data))
newfile1.append(data)
@@ -64,7 +63,6 @@
def test_alias(self):
# Add a file (and so also add an alias)
data = 'data ' * 50
- digest = hashlib.sha1(data).hexdigest()
newfile = self.storage.startAddFile('file1', len(data))
newfile.mimetype = 'text/unknown'
newfile.append(data)
@@ -119,8 +117,8 @@
fileid2, aliasid2 = newfile2.store()
# Create rows in the database for these files.
- content1 = LibraryFileContent(filesize=0, sha1='foo', md5='xx', id=6661)
- content2 = LibraryFileContent(filesize=0, sha1='foo', md5='xx', id=6662)
+ LibraryFileContent(filesize=0, sha1='foo', md5='xx', id=6661)
+ LibraryFileContent(filesize=0, sha1='foo', md5='xx', id=6662)
flush_database_updates()
# And no errors should have been raised!
=== modified file 'lib/canonical/librarian/ftests/test_web.py'
--- lib/canonical/librarian/ftests/test_web.py 2010-10-20 20:51:26 +0000
+++ lib/canonical/librarian/ftests/test_web.py 2010-11-06 13:09:51 +0000
@@ -22,8 +22,10 @@
flush_database_updates,
session_store,
)
-from canonical.launchpad.database import LibraryFileAlias
-from canonical.launchpad.database.librarian import TimeLimitedToken
+from canonical.launchpad.database.librarian import (
+ LibraryFileAlias,
+ TimeLimitedToken,
+ )
from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet
from canonical.launchpad.interfaces.lpstorm import IMasterStore
from canonical.librarian.client import (
=== modified file 'lib/lp/bugs/doc/bugnotification-threading.txt'
--- lib/lp/bugs/doc/bugnotification-threading.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/bugs/doc/bugnotification-threading.txt 2010-11-06 13:09:51 +0000
@@ -10,7 +10,7 @@
Let's add add change notification and see how it works:
>>> from canonical.database.sqlbase import flush_database_updates
- >>> from canonical.launchpad.database import MessageSet
+ >>> from canonical.launchpad.database.message import MessageSet
>>> login('test@xxxxxxxxxxxxx')
=== modified file 'lib/lp/registry/model/person.py'
--- lib/lp/registry/model/person.py 2010-11-04 17:52:48 +0000
+++ lib/lp/registry/model/person.py 2010-11-06 13:09:51 +0000
@@ -4032,7 +4032,7 @@
def cacheBrandingForPeople(self, people):
"""See `IPersonSet`."""
- from canonical.launchpad.database import LibraryFileAlias
+ from canonical.launchpad.database.librarian import LibraryFileAlias
aliases = []
aliases.extend(person.iconID for person in people
if person.iconID is not None)
=== modified file 'lib/lp/registry/stories/gpg-coc/01-claimgpg.txt'
--- lib/lp/registry/stories/gpg-coc/01-claimgpg.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/registry/stories/gpg-coc/01-claimgpg.txt 2010-11-06 13:09:51 +0000
@@ -220,7 +220,7 @@
>>> nothing, token_value = token_url.split('http://launchpad.dev/token/')
>>> import pytz, datetime
- >>> from canonical.launchpad.database import LoginToken
+ >>> from canonical.launchpad.database.logintoken import LoginToken
>>> logintoken = LoginToken.selectOneBy(token=token_value)
>>> logintoken.date_created = datetime.datetime(
... 2005,04,01, 12,00,00, tzinfo=pytz.timezone('UTC'))
=== modified file 'lib/lp/registry/stories/mailinglists/hosted-email-address.txt'
--- lib/lp/registry/stories/mailinglists/hosted-email-address.txt 2009-08-29 03:14:48 +0000
+++ lib/lp/registry/stories/mailinglists/hosted-email-address.txt 2010-11-06 13:09:51 +0000
@@ -11,7 +11,7 @@
>>> logout()
>>> transaction.commit()
- >>> from canonical.launchpad.database import EmailAddressSet
+ >>> from canonical.launchpad.database.emailaddress import EmailAddressSet
>>> email_set = EmailAddressSet()
>>> email_set.getByEmail(mailing_list.address)
<EmailAddress at...
=== modified file 'lib/lp/soyuz/browser/tests/distroseriesqueue-views.txt'
--- lib/lp/soyuz/browser/tests/distroseriesqueue-views.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/soyuz/browser/tests/distroseriesqueue-views.txt 2010-11-06 13:09:51 +0000
@@ -6,7 +6,7 @@
Let's instantiate the view for +queue for anonymous access:
>>> from zope.component import queryMultiAdapter
- >>> from canonical.launchpad.database import LibraryFileAlias
+ >>> from canonical.launchpad.database.librarian import LibraryFileAlias
>>> from canonical.launchpad.webapp.servers import LaunchpadTestRequest
>>> from lp.registry.interfaces.distribution import IDistributionSet
>>> fake_chroot = LibraryFileAlias.get(1)
=== modified file 'lib/lp/soyuz/doc/package-diff.txt'
--- lib/lp/soyuz/doc/package-diff.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/soyuz/doc/package-diff.txt 2010-11-06 13:09:51 +0000
@@ -116,7 +116,7 @@
>>> from lp.soyuz.model.component import (
... ComponentSelection)
- >>> from canonical.launchpad.database import LibraryFileAlias
+ >>> from canonical.launchpad.database.librarian import LibraryFileAlias
>>> from lp.soyuz.interfaces.component import IComponentSet
>>> hoary = ubuntu.getSeries('hoary')
=== modified file 'lib/lp/soyuz/doc/soyuz-set-of-uploads.txt'
--- lib/lp/soyuz/doc/soyuz-set-of-uploads.txt 2010-11-06 13:09:50 +0000
+++ lib/lp/soyuz/doc/soyuz-set-of-uploads.txt 2010-11-06 13:09:51 +0000
@@ -75,7 +75,7 @@
>>> from lp.soyuz.enums import PackageUploadStatus
>>> from lp.soyuz.scripts.initialise_distroseries import (
... InitialiseDistroSeries)
- >>> from canonical.launchpad.database import LibraryFileAlias
+ >>> from canonical.launchpad.database.librarian import LibraryFileAlias
>>> ubuntu = Distribution.byName('ubuntu')
>>> breezy_autotest = ubuntu['breezy-autotest']
>>> ubuntutest = Distribution.byName('ubuntutest')
=== modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-files.txt'
--- lib/lp/soyuz/stories/ppa/xx-ppa-files.txt 2010-10-18 22:24:59 +0000
+++ lib/lp/soyuz/stories/ppa/xx-ppa-files.txt 2010-11-06 13:09:51 +0000
@@ -405,7 +405,6 @@
# Attach an existing file (the 'test-pkg_1.0.dsc') to a deleted
# LibraryFileContent.
- >>> from canonical.launchpad.database import LibraryFileContent
>>> from canonical.launchpad.webapp.interfaces import (
... IStoreSelector, MAIN_STORE, MASTER_FLAVOR)
>>> login('foo.bar@xxxxxxxxxxxxx')
=== modified file 'lib/lp/soyuz/tests/soyuz.py'
--- lib/lp/soyuz/tests/soyuz.py 2010-10-04 19:50:45 +0000
+++ lib/lp/soyuz/tests/soyuz.py 2010-11-06 13:09:51 +0000
@@ -15,7 +15,7 @@
from zope.component import getUtility
from canonical.config import config
-from canonical.launchpad.database import LibraryFileAlias
+from canonical.launchpad.database.librarian import LibraryFileAlias
from canonical.launchpad.ftests import (
import_public_test_keys,
syncUpdate,
=== modified file 'lib/lp/soyuz/tests/test_doc.py'
--- lib/lp/soyuz/tests/test_doc.py 2010-10-27 14:25:19 +0000
+++ lib/lp/soyuz/tests/test_doc.py 2010-11-06 13:09:51 +0000
@@ -45,7 +45,7 @@
code that did not use the ValidPersonOrTeamCache to determine
validity.
"""
- from canonical.launchpad.database import EmailAddress
+ from canonical.launchpad.database.emailaddress import EmailAddress
from canonical.launchpad.interfaces.emailaddress import EmailAddressStatus
stevea_emailaddress = EmailAddress.byEmail(
'steve.alexander@xxxxxxxxxxxxxxx')
=== modified file 'lib/lp/translations/doc/pofile.txt'
--- lib/lp/translations/doc/pofile.txt 2010-11-05 14:56:34 +0000
+++ lib/lp/translations/doc/pofile.txt 2010-11-06 13:09:51 +0000
@@ -1113,8 +1113,8 @@
contributed translations on a given language for that distroseries, you
can use the getPOFileContributorsByLanguage() method of IDistroSeries.
- >>> from canonical.launchpad.database import Language
>>> from lp.registry.model.distroseries import DistroSeries
+ >>> from lp.services.worlddata.model.language import Language
>>> hoary = DistroSeries.selectOneBy(name="hoary")
>>> spanish = Language.selectOneBy(code="es")
>>> print_names(hoary.getPOFileContributorsByLanguage(spanish))
=== modified file 'scripts/branch-rewrite.py'
--- scripts/branch-rewrite.py 2010-09-27 04:20:23 +0000
+++ scripts/branch-rewrite.py 2010-11-06 13:09:51 +0000
@@ -17,10 +17,6 @@
import os
import sys
-# XXX, MichaelHudson, 2009-07-22, bug=402845: This pointless import avoids a
-# circular import killing us.
-from canonical.launchpad.database import account
-
from canonical.database.sqlbase import ISOLATION_LEVEL_AUTOCOMMIT
from canonical.config import config
from lp.codehosting.rewrite import BranchRewriter