Merge lp:~jml/launchpad/database-apocalypse into lp:launchpad
- database-apocalypse
- Merge into devel
Proposed by
Jonathan Lange
Status: | Merged |
---|---|
Approved by: | Jonathan Lange |
Approved revision: | no longer in the source branch. |
Merged at revision: | 11905 |
Proposed branch: | lp:~jml/launchpad/database-apocalypse |
Merge into: | lp:launchpad |
Prerequisite: | lp:~jml/launchpad/circular-rage |
Diff against target: |
687 lines (+62/-260) 32 files modified
database/schema/pending/carlos-fix-duplicated-submissions.py (+0/-180) lib/canonical/database/harness.py (+7/-11) lib/canonical/launchpad/database/__init__.py (+9/-11) lib/canonical/launchpad/database/ftests/__init__.py (+0/-6) lib/canonical/launchpad/database/tests/test_imports.py (+0/-14) lib/canonical/launchpad/database/tests/test_message.py (+1/-1) lib/canonical/launchpad/database/tests/test_timelimitedtoken.py (+0/-1) lib/canonical/launchpad/doc/batch_navigation.txt (+1/-1) lib/canonical/launchpad/doc/librarian.txt (+1/-1) lib/canonical/launchpad/doc/storm.txt (+5/-2) lib/canonical/launchpad/doc/webapp-publication.txt (+1/-1) lib/canonical/launchpad/ftests/test_system_documentation.py (+1/-1) lib/canonical/launchpad/pagetests/temporaryblobstorage/xx-tempstorage.txt (+2/-1) lib/canonical/launchpad/scripts/ftests/librarianformatter.txt (+1/-1) lib/canonical/librarian/client.py (+3/-3) lib/canonical/librarian/ftests/test_client.py (+1/-1) lib/canonical/librarian/ftests/test_gc.py (+8/-2) lib/canonical/librarian/ftests/test_storage.py (+3/-5) lib/canonical/librarian/ftests/test_web.py (+4/-2) lib/lp/bugs/doc/bugnotification-threading.txt (+1/-1) lib/lp/registry/model/person.py (+1/-1) lib/lp/registry/stories/gpg-coc/01-claimgpg.txt (+1/-1) lib/lp/registry/stories/mailinglists/hosted-email-address.txt (+1/-1) lib/lp/services/worlddata/model/language.py (+4/-0) lib/lp/soyuz/browser/tests/distroseriesqueue-views.txt (+1/-1) lib/lp/soyuz/doc/package-diff.txt (+1/-1) lib/lp/soyuz/doc/soyuz-set-of-uploads.txt (+1/-1) lib/lp/soyuz/stories/ppa/xx-ppa-files.txt (+0/-1) lib/lp/soyuz/tests/soyuz.py (+1/-1) lib/lp/soyuz/tests/test_doc.py (+1/-1) lib/lp/translations/doc/pofile.txt (+1/-1) scripts/branch-rewrite.py (+0/-4) |
To merge this branch: | bzr merge lp:~jml/launchpad/database-apocalypse |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Collins (community) | Approve | ||
Jonathan Lange (community) | Approve | ||
Review via email: mp+40253@code.launchpad.net |
Commit message
[r=jml]
Description of the change
This branch builds on the work in circular-rage to remove all of the re-imports from canonical.
It changes every remaining import like 'from canonical.
In the process, I've deleted some files that looked obsolete, notably in database/
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === removed file 'database/schema/pending/carlos-fix-duplicated-submissions.py' |
2 | --- database/schema/pending/carlos-fix-duplicated-submissions.py 2009-06-24 21:17:33 +0000 |
3 | +++ database/schema/pending/carlos-fix-duplicated-submissions.py 1970-01-01 00:00:00 +0000 |
4 | @@ -1,180 +0,0 @@ |
5 | -#!/usr/bin/env python |
6 | -# |
7 | -# Copyright 2009 Canonical Ltd. This software is licensed under the |
8 | -# GNU Affero General Public License version 3 (see the file LICENSE). |
9 | - |
10 | -import sys |
11 | -from optparse import OptionParser |
12 | - |
13 | -from canonical.config import config |
14 | -from canonical.lp import initZopeless |
15 | -from canonical.database.sqlbase import cursor |
16 | -from canonical.launchpad.scripts import ( |
17 | - execute_zcml_for_scripts, logger, logger_options) |
18 | -from canonical.launchpad.database import POFile |
19 | - |
20 | -POMSGSETID = 0 |
21 | -POSELECTIONID = 1 |
22 | -ACTIVESUBMISSION = 2 |
23 | -PUBLISHEDSUBMISSION = 3 |
24 | -PLURALFORM = 4 |
25 | -POSUBMISSIONID = 5 |
26 | -POTRANSLATION = 6 |
27 | -LATESTSUBMISSION = 7 |
28 | - |
29 | -def parse_options(args): |
30 | - """Parse a set of command line options. |
31 | - |
32 | - Return an optparse.Values object. |
33 | - """ |
34 | - parser = OptionParser() |
35 | - |
36 | - parser.add_option("-c", "--check", dest="check", |
37 | - default=False, |
38 | - action='store_true', |
39 | - help=("Whether the script should only check if there are duplicated" |
40 | - "entries.") |
41 | - ) |
42 | - |
43 | - # Add the verbose/quiet options. |
44 | - logger_options(parser) |
45 | - |
46 | - (options, args) = parser.parse_args(args) |
47 | - |
48 | - return options |
49 | - |
50 | -def main(argv): |
51 | - options = parse_options(argv[1:]) |
52 | - |
53 | - # Get the global logger for this task. |
54 | - logger_object = logger(options, 'rosetta-poimport') |
55 | - |
56 | - if options.check: |
57 | - logger_object.info('Starting the checking process.') |
58 | - else: |
59 | - logger_object.info('Starting the fixing process.') |
60 | - |
61 | - # Setup zcml machinery to be able to use getUtility |
62 | - execute_zcml_for_scripts() |
63 | - ztm = initZopeless(dbuser=config.rosettaadmin.dbuser) |
64 | - |
65 | - # Get the list of POFiles. |
66 | - cur = cursor() |
67 | - cur.execute("SELECT id FROM POFile") |
68 | - pofile_ids = cur.fetchall() |
69 | - pofile_ids = [set_entry[0] for set_entry in pofile_ids] |
70 | - |
71 | - duplicates_found = 0 |
72 | - processed = 0 |
73 | - for pofileid in pofile_ids: |
74 | - # Get all its POMsgSet entries. |
75 | - cur = cursor() |
76 | - cur.execute(""" |
77 | - SELECT |
78 | - POMsgSet.id, |
79 | - POSelection.id, |
80 | - POSelection.activesubmission, |
81 | - POSelection.publishedsubmission, |
82 | - POSelection.pluralform, |
83 | - POSubmission.id, |
84 | - POSubmission.potranslation, |
85 | - POFile.latestsubmission |
86 | - FROM |
87 | - POFile |
88 | - JOIN POMsgSet ON POMsgSet.pofile = POFile.id |
89 | - JOIN POSubmission ON POSubmission.pomsgset = POMsgSet.id |
90 | - LEFT OUTER JOIN POSelection ON |
91 | - POSelection.pomsgset = POMsgSet.id AND |
92 | - POSelection.pluralform = POSubmission.pluralform |
93 | - WHERE POFile.id = %d |
94 | - ORDER BY |
95 | - POMsgSet.id, POSubmission.pluralform, |
96 | - POSubmission.potranslation, POSubmission.datecreated; |
97 | - """ % pofileid) |
98 | - |
99 | - rows = cur.fetchall() |
100 | - current_pomsgset = None |
101 | - needs_recalculate = False |
102 | - duplicated_ids = [] |
103 | - for row in rows: |
104 | - if current_pomsgset != row[POMSGSETID]: |
105 | - # It's a new POMsgSet |
106 | - current_pomsgset = row[POMSGSETID] |
107 | - current_pluralform = None |
108 | - if current_pluralform != row[PLURALFORM]: |
109 | - current_pluralform = row[PLURALFORM] |
110 | - current_translation = None |
111 | - current_posubmission = None |
112 | - if current_translation != row[POTRANSLATION]: |
113 | - current_translation = row[POTRANSLATION] |
114 | - current_posubmission = row[POSUBMISSIONID] |
115 | - else: |
116 | - # This submission is a duplicate of current_posubmission |
117 | - # because the translations are the same, and we should have |
118 | - # just one posubmission for a given translation. |
119 | - duplicated_ids.append(row[POSUBMISSIONID]) |
120 | - duplicates_found += 1 |
121 | - |
122 | - if options.check: |
123 | - # We are only checking, don't execute the write |
124 | - # operations. |
125 | - continue |
126 | - |
127 | - if row[ACTIVESUBMISSION] == row[POSUBMISSIONID]: |
128 | - # We need to remove this reference to the submission we |
129 | - # are going to remove later because it's a duplicate. |
130 | - cur = cursor() |
131 | - cur.execute(""" |
132 | - UPDATE POSelection |
133 | - SET activesubmission = %d |
134 | - WHERE id = %d""" % ( |
135 | - current_posubmission, row[POSELECTIONID])) |
136 | - |
137 | - if row[PUBLISHEDSUBMISSION] == row[POSUBMISSIONID]: |
138 | - # We need to remove this reference to the submission we |
139 | - # are going to remove later because it's a duplicate. |
140 | - cur = cursor() |
141 | - cur.execute(""" |
142 | - UPDATE POSelection |
143 | - SET publishedsubmission = %d |
144 | - WHERE id = %d""" % ( |
145 | - current_posubmission, row[POSELECTIONID])) |
146 | - if row[LATESTSUBMISSION] == row[POSUBMISSIONID]: |
147 | - # We need to remove this reference to the submission we |
148 | - # are going to remove later because it's a duplicate. |
149 | - cur = cursor() |
150 | - cur.execute(""" |
151 | - UPDATE POFile |
152 | - SET latestsubmission = NULL |
153 | - WHERE id = %d""" % pofileid) |
154 | - needs_recalculate = True |
155 | - processed += 1 |
156 | - if processed % 50000 == 0: |
157 | - logger_object.info('Processed %d POSubmissions' % processed) |
158 | - |
159 | - if not options.check: |
160 | - for duplicate in duplicated_ids: |
161 | - # Remove all duplicates. |
162 | - cur = cursor() |
163 | - cur.execute( |
164 | - "DELETE FROM POSubmission WHERE id = %d" % duplicate) |
165 | - if needs_recalculate: |
166 | - # We removed the latestsubmission for this |
167 | - # entry, we need to recalculate it now that the |
168 | - # duplicate entries are removed. |
169 | - pofile = POFile.get(pofileid) |
170 | - pofile.recalculateLatestSubmission() |
171 | - ztm.commit() |
172 | - |
173 | - if options.check: |
174 | - logger_object.info( |
175 | - 'Finished the checking process and found %d entries to be fixed' |
176 | - ' in %d POSubmissions objects.' % (duplicates_found, processed)) |
177 | - else: |
178 | - logger_object.info( |
179 | - 'Finished the fixing process. We fixed %d duplicates in %d' |
180 | - ' POSubmissions objects.' % (duplicates_found, processed)) |
181 | - |
182 | - |
183 | -if __name__ == '__main__': |
184 | - main(sys.argv) |
185 | |
186 | === modified file 'lib/canonical/database/harness.py' |
187 | --- lib/canonical/database/harness.py 2010-11-08 13:11:30 +0000 |
188 | +++ lib/canonical/database/harness.py 2010-11-11 00:10:33 +0000 |
189 | @@ -22,22 +22,18 @@ |
190 | import transaction |
191 | |
192 | from zope.component import getUtility |
193 | -from zope.configuration import xmlconfig |
194 | |
195 | from canonical.launchpad.scripts import execute_zcml_for_scripts |
196 | |
197 | -# |
198 | -# We don't really depend on everything from canonical.launchpad.database and |
199 | -# canonical.launchpad.interfaces, but it's good to have this available in the |
200 | -# namespace. |
201 | -# |
202 | -# pylint: disable-msg=W0614,W0401 |
203 | -from canonical.launchpad.database import * |
204 | +from lp.answers.model.question import Question |
205 | +from lp.blueprints.model.specification import Specification |
206 | from lp.bugs.model.bug import Bug |
207 | +from lp.registry.model.distribution import Distribution |
208 | +from lp.registry.model.distroseries import DistroSeries |
209 | +from lp.registry.model.person import Person |
210 | +from lp.registry.model.product import Product |
211 | +from lp.registry.model.projectgroup import ProjectGroup |
212 | from lp.testing.factory import LaunchpadObjectFactory |
213 | -from lp.testing.mail import create_mail_for_directoryMailBox |
214 | -from canonical.launchpad.testing.systemdocs import ( |
215 | - create_initialized_view, create_view) |
216 | |
217 | from zope.interface.verify import verifyObject |
218 | |
219 | |
220 | === modified file 'lib/canonical/launchpad/database/__init__.py' |
221 | --- lib/canonical/launchpad/database/__init__.py 2010-11-11 00:10:29 +0000 |
222 | +++ lib/canonical/launchpad/database/__init__.py 2010-11-11 00:10:33 +0000 |
223 | @@ -1,14 +1,12 @@ |
224 | # Copyright 2009-2010 Canonical Ltd. This software is licensed under the |
225 | # GNU Affero General Public License version 3 (see the file LICENSE). |
226 | |
227 | -# pylint: disable-msg=W0401,C0301 |
228 | - |
229 | -from canonical.launchpad.database.account import * |
230 | -from canonical.launchpad.database.emailaddress import * |
231 | -from canonical.launchpad.database.librarian import * |
232 | -from canonical.launchpad.database.logintoken import * |
233 | -from canonical.launchpad.database.message import * |
234 | -from canonical.launchpad.database.oauth import * |
235 | -from canonical.launchpad.database.temporaryblobstorage import * |
236 | -from lp.services.worlddata.model.language import * |
237 | -from lp.services.worlddata.model.spokenin import * |
238 | +"""Database / model code for bits of Launchpad that don't fit anywhere else. |
239 | + |
240 | +See also `canonical.launchpad.interfaces` for the public interfaces for this |
241 | +code. |
242 | + |
243 | +DEPRECATED: This package is deprecated. Do not add any new modules to this |
244 | +package. Where possible, move things out of this package into better |
245 | +locations under the 'lp' package. See the `lp` docstring for more details. |
246 | +""" |
247 | |
248 | === removed directory 'lib/canonical/launchpad/database/ftests' |
249 | === removed file 'lib/canonical/launchpad/database/ftests/__init__.py' |
250 | --- lib/canonical/launchpad/database/ftests/__init__.py 2009-06-25 05:39:50 +0000 |
251 | +++ lib/canonical/launchpad/database/ftests/__init__.py 1970-01-01 00:00:00 +0000 |
252 | @@ -1,6 +0,0 @@ |
253 | -# Copyright 2009 Canonical Ltd. This software is licensed under the |
254 | -# GNU Affero General Public License version 3 (see the file LICENSE). |
255 | - |
256 | -"""Functional tests.""" |
257 | - |
258 | -__metaclass__ = type |
259 | |
260 | === removed file 'lib/canonical/launchpad/database/tests/test_imports.py' |
261 | --- lib/canonical/launchpad/database/tests/test_imports.py 2010-08-20 20:31:18 +0000 |
262 | +++ lib/canonical/launchpad/database/tests/test_imports.py 1970-01-01 00:00:00 +0000 |
263 | @@ -1,14 +0,0 @@ |
264 | -# Copyright 2009 Canonical Ltd. This software is licensed under the |
265 | -# GNU Affero General Public License version 3 (see the file LICENSE). |
266 | - |
267 | -# Authors : Robert Collins <robert.collins@canonical.com> |
268 | -# Tests that various database modules can be imported. |
269 | - |
270 | -import sys |
271 | -import unittest |
272 | - |
273 | - |
274 | -def test_suite(): |
275 | - return unittest.TestLoader().loadTestsFromModule(sys.modules[__name__]) |
276 | - |
277 | - |
278 | |
279 | === modified file 'lib/canonical/launchpad/database/tests/test_message.py' |
280 | --- lib/canonical/launchpad/database/tests/test_message.py 2010-10-04 19:50:45 +0000 |
281 | +++ lib/canonical/launchpad/database/tests/test_message.py 2010-11-11 00:10:33 +0000 |
282 | @@ -18,7 +18,7 @@ |
283 | import transaction |
284 | from zope.component import getUtility |
285 | |
286 | -from canonical.launchpad.database import ( |
287 | +from canonical.launchpad.database.message import ( |
288 | MessageJob, |
289 | MessageJobAction, |
290 | MessageSet, |
291 | |
292 | === renamed file 'lib/canonical/launchpad/database/ftests/test_timelimitedtoken.py' => 'lib/canonical/launchpad/database/tests/test_timelimitedtoken.py' |
293 | --- lib/canonical/launchpad/database/ftests/test_timelimitedtoken.py 2010-10-04 19:50:45 +0000 |
294 | +++ lib/canonical/launchpad/database/tests/test_timelimitedtoken.py 2010-11-11 00:10:33 +0000 |
295 | @@ -6,7 +6,6 @@ |
296 | __metaclass__ = type |
297 | |
298 | import testtools |
299 | -import transaction |
300 | |
301 | from canonical.database.sqlbase import session_store |
302 | from canonical.launchpad.database.librarian import TimeLimitedToken |
303 | |
304 | === modified file 'lib/canonical/launchpad/doc/batch_navigation.txt' |
305 | --- lib/canonical/launchpad/doc/batch_navigation.txt 2010-10-18 22:24:59 +0000 |
306 | +++ lib/canonical/launchpad/doc/batch_navigation.txt 2010-11-11 00:10:33 +0000 |
307 | @@ -56,7 +56,7 @@ |
308 | Imports and initialization: |
309 | |
310 | >>> from canonical.ftests.pgsql import CursorWrapper |
311 | - >>> from canonical.launchpad.database import EmailAddress |
312 | + >>> from canonical.launchpad.database.emailaddress import EmailAddress |
313 | >>> from canonical.launchpad.interfaces.lpstorm import IStore |
314 | >>> ignore = IStore(EmailAddress) # Prime the database connection. |
315 | ... # (Priming is important if this test is run in isolation). |
316 | |
317 | === modified file 'lib/canonical/launchpad/doc/librarian.txt' |
318 | --- lib/canonical/launchpad/doc/librarian.txt 2010-10-18 22:24:59 +0000 |
319 | +++ lib/canonical/launchpad/doc/librarian.txt 2010-11-11 00:10:33 +0000 |
320 | @@ -520,7 +520,7 @@ |
321 | |
322 | # Create a new LibraryFileAlias not referencing any LibraryFileContent |
323 | # record. Such records are considered as being deleted. |
324 | - >>> from canonical.launchpad.database import LibraryFileAlias |
325 | + >>> from canonical.launchpad.database.librarian import LibraryFileAlias |
326 | >>> from canonical.launchpad.webapp.interfaces import ( |
327 | ... IStoreSelector, MAIN_STORE, MASTER_FLAVOR) |
328 | |
329 | |
330 | === modified file 'lib/canonical/launchpad/doc/storm.txt' |
331 | --- lib/canonical/launchpad/doc/storm.txt 2010-10-19 18:44:31 +0000 |
332 | +++ lib/canonical/launchpad/doc/storm.txt 2010-11-11 00:10:33 +0000 |
333 | @@ -16,8 +16,11 @@ |
334 | ... ISlaveStore, |
335 | ... IStore, |
336 | ... ) |
337 | - >>> from canonical.launchpad.database import ( |
338 | - ... Account, AccountPassword, EmailAddress) |
339 | + >>> from canonical.launchpad.database.account import ( |
340 | + ... Account, |
341 | + ... AccountPassword, |
342 | + ... ) |
343 | + >>> from canonical.launchpad.database.emailaddress import EmailAddress |
344 | >>> from zope.security.proxy import ProxyFactory |
345 | >>> from lp.registry.interfaces.person import IPersonSet |
346 | >>> from lp.registry.model.person import Person |
347 | |
348 | === modified file 'lib/canonical/launchpad/doc/webapp-publication.txt' |
349 | --- lib/canonical/launchpad/doc/webapp-publication.txt 2010-10-18 22:24:59 +0000 |
350 | +++ lib/canonical/launchpad/doc/webapp-publication.txt 2010-11-11 00:10:33 +0000 |
351 | @@ -909,7 +909,7 @@ |
352 | In the default implementation, the following database modification will |
353 | be automatically reverted in a GET request. |
354 | |
355 | - >>> from canonical.launchpad.database import EmailAddress |
356 | + >>> from canonical.launchpad.database.emailaddress import EmailAddress |
357 | >>> from canonical.launchpad.ftests import syncUpdate |
358 | >>> from canonical.launchpad.interfaces.lpstorm import IMasterStore |
359 | >>> from lp.registry.model.person import Person |
360 | |
361 | === modified file 'lib/canonical/launchpad/ftests/test_system_documentation.py' |
362 | --- lib/canonical/launchpad/ftests/test_system_documentation.py 2010-10-26 15:48:33 +0000 |
363 | +++ lib/canonical/launchpad/ftests/test_system_documentation.py 2010-11-11 00:10:33 +0000 |
364 | @@ -63,7 +63,7 @@ |
365 | code that did not use the ValidPersonOrTeamCache to determine |
366 | validity. |
367 | """ |
368 | - from canonical.launchpad.database import EmailAddress |
369 | + from canonical.launchpad.database.emailaddress import EmailAddress |
370 | from canonical.launchpad.interfaces.emailaddress import EmailAddressStatus |
371 | stevea_emailaddress = EmailAddress.byEmail( |
372 | 'steve.alexander@ubuntulinux.com') |
373 | |
374 | === modified file 'lib/canonical/launchpad/pagetests/temporaryblobstorage/xx-tempstorage.txt' |
375 | --- lib/canonical/launchpad/pagetests/temporaryblobstorage/xx-tempstorage.txt 2010-06-16 07:45:46 +0000 |
376 | +++ lib/canonical/launchpad/pagetests/temporaryblobstorage/xx-tempstorage.txt 2010-11-11 00:10:33 +0000 |
377 | @@ -32,7 +32,8 @@ |
378 | |
379 | >>> from canonical.launchpad.ftests import login, logout, ANONYMOUS |
380 | >>> login(ANONYMOUS) |
381 | - >>> from canonical.launchpad.database import TemporaryBlobStorage |
382 | + >>> from canonical.launchpad.database.temporaryblobstorage import ( |
383 | + ... TemporaryBlobStorage) |
384 | >>> blob = TemporaryBlobStorage.byUuid(ticket) |
385 | >>> blob.blob |
386 | 'abcd\x00efg' |
387 | |
388 | === modified file 'lib/canonical/launchpad/scripts/ftests/librarianformatter.txt' |
389 | --- lib/canonical/launchpad/scripts/ftests/librarianformatter.txt 2010-10-04 19:50:45 +0000 |
390 | +++ lib/canonical/launchpad/scripts/ftests/librarianformatter.txt 2010-11-11 00:10:33 +0000 |
391 | @@ -92,7 +92,7 @@ |
392 | |
393 | >>> match = re.search('/(\d+)/', url) |
394 | >>> alias_id = match.group(1) |
395 | ->>> from canonical.launchpad.database import LibraryFileAlias |
396 | +>>> from canonical.launchpad.database.librarian import LibraryFileAlias |
397 | >>> transaction.abort() # To see db changes made by the librarian |
398 | >>> alias = LibraryFileAlias.get(alias_id) |
399 | >>> now = datetime.now().replace(tzinfo=utc) |
400 | |
401 | === modified file 'lib/canonical/librarian/client.py' |
402 | --- lib/canonical/librarian/client.py 2010-09-10 04:07:04 +0000 |
403 | +++ lib/canonical/librarian/client.py 2010-11-11 00:10:33 +0000 |
404 | @@ -126,8 +126,8 @@ |
405 | name = name.encode('utf-8') |
406 | |
407 | # Import in this method to avoid a circular import |
408 | - from canonical.launchpad.database import LibraryFileContent |
409 | - from canonical.launchpad.database import LibraryFileAlias |
410 | + from canonical.launchpad.database.librarian import LibraryFileContent |
411 | + from canonical.launchpad.database.librarian import LibraryFileAlias |
412 | |
413 | self._connect() |
414 | try: |
415 | @@ -314,7 +314,7 @@ |
416 | :raises: `DownloadFailed` if the alias is invalid or |
417 | inaccessible. |
418 | """ |
419 | - from canonical.launchpad.database import LibraryFileAlias |
420 | + from canonical.launchpad.database.librarian import LibraryFileAlias |
421 | from sqlobject import SQLObjectNotFound |
422 | try: |
423 | lfa = LibraryFileAlias.get(aliasID) |
424 | |
425 | === modified file 'lib/canonical/librarian/ftests/test_client.py' |
426 | --- lib/canonical/librarian/ftests/test_client.py 2010-10-04 19:50:45 +0000 |
427 | +++ lib/canonical/librarian/ftests/test_client.py 2010-11-11 00:10:33 +0000 |
428 | @@ -15,7 +15,7 @@ |
429 | from canonical.librarian.client import ( |
430 | LibrarianClient, LibrarianServerError, RestrictedLibrarianClient) |
431 | from canonical.librarian.interfaces import UploadFailed |
432 | -from canonical.launchpad.database import LibraryFileAlias |
433 | +from canonical.launchpad.database.librarian import LibraryFileAlias |
434 | |
435 | |
436 | class InstrumentedLibrarianClient(LibrarianClient): |
437 | |
438 | === modified file 'lib/canonical/librarian/ftests/test_gc.py' |
439 | --- lib/canonical/librarian/ftests/test_gc.py 2010-10-04 19:50:45 +0000 |
440 | +++ lib/canonical/librarian/ftests/test_gc.py 2010-11-11 00:10:33 +0000 |
441 | @@ -20,8 +20,14 @@ |
442 | |
443 | from canonical.config import config |
444 | from canonical.database.sqlbase import ( |
445 | - connect, cursor, ISOLATION_LEVEL_AUTOCOMMIT) |
446 | -from canonical.launchpad.database import LibraryFileAlias, LibraryFileContent |
447 | + connect, |
448 | + cursor, |
449 | + ISOLATION_LEVEL_AUTOCOMMIT, |
450 | + ) |
451 | +from canonical.launchpad.database.librarian import ( |
452 | + LibraryFileAlias, |
453 | + LibraryFileContent, |
454 | + ) |
455 | from canonical.librarian import librariangc |
456 | from canonical.librarian.client import LibrarianClient |
457 | from canonical.testing.layers import LaunchpadZopelessLayer |
458 | |
459 | === modified file 'lib/canonical/librarian/ftests/test_storage.py' |
460 | --- lib/canonical/librarian/ftests/test_storage.py 2010-10-04 19:50:45 +0000 |
461 | +++ lib/canonical/librarian/ftests/test_storage.py 2010-11-11 00:10:33 +0000 |
462 | @@ -10,7 +10,7 @@ |
463 | from canonical.librarian.storage import LibraryFileUpload, DuplicateFileIDError |
464 | from canonical.librarian import db |
465 | from canonical.database.sqlbase import flush_database_updates |
466 | -from canonical.launchpad.database import LibraryFileContent, LibraryFileAlias |
467 | +from canonical.launchpad.database.librarian import LibraryFileContent |
468 | from canonical.testing.layers import LaunchpadZopelessLayer |
469 | |
470 | |
471 | @@ -37,7 +37,6 @@ |
472 | def test_addFiles_identical(self): |
473 | # Start adding two files with identical data |
474 | data = 'data ' * 5000 |
475 | - digest = hashlib.sha1(data).hexdigest() |
476 | newfile1 = self.storage.startAddFile('file1', len(data)) |
477 | newfile2 = self.storage.startAddFile('file2', len(data)) |
478 | newfile1.append(data) |
479 | @@ -64,7 +63,6 @@ |
480 | def test_alias(self): |
481 | # Add a file (and so also add an alias) |
482 | data = 'data ' * 50 |
483 | - digest = hashlib.sha1(data).hexdigest() |
484 | newfile = self.storage.startAddFile('file1', len(data)) |
485 | newfile.mimetype = 'text/unknown' |
486 | newfile.append(data) |
487 | @@ -119,8 +117,8 @@ |
488 | fileid2, aliasid2 = newfile2.store() |
489 | |
490 | # Create rows in the database for these files. |
491 | - content1 = LibraryFileContent(filesize=0, sha1='foo', md5='xx', id=6661) |
492 | - content2 = LibraryFileContent(filesize=0, sha1='foo', md5='xx', id=6662) |
493 | + LibraryFileContent(filesize=0, sha1='foo', md5='xx', id=6661) |
494 | + LibraryFileContent(filesize=0, sha1='foo', md5='xx', id=6662) |
495 | |
496 | flush_database_updates() |
497 | # And no errors should have been raised! |
498 | |
499 | === modified file 'lib/canonical/librarian/ftests/test_web.py' |
500 | --- lib/canonical/librarian/ftests/test_web.py 2010-10-20 20:51:26 +0000 |
501 | +++ lib/canonical/librarian/ftests/test_web.py 2010-11-11 00:10:33 +0000 |
502 | @@ -22,8 +22,10 @@ |
503 | flush_database_updates, |
504 | session_store, |
505 | ) |
506 | -from canonical.launchpad.database import LibraryFileAlias |
507 | -from canonical.launchpad.database.librarian import TimeLimitedToken |
508 | +from canonical.launchpad.database.librarian import ( |
509 | + LibraryFileAlias, |
510 | + TimeLimitedToken, |
511 | + ) |
512 | from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet |
513 | from canonical.launchpad.interfaces.lpstorm import IMasterStore |
514 | from canonical.librarian.client import ( |
515 | |
516 | === modified file 'lib/lp/bugs/doc/bugnotification-threading.txt' |
517 | --- lib/lp/bugs/doc/bugnotification-threading.txt 2010-10-18 22:24:59 +0000 |
518 | +++ lib/lp/bugs/doc/bugnotification-threading.txt 2010-11-11 00:10:33 +0000 |
519 | @@ -10,7 +10,7 @@ |
520 | Let's add add change notification and see how it works: |
521 | |
522 | >>> from canonical.database.sqlbase import flush_database_updates |
523 | - >>> from canonical.launchpad.database import MessageSet |
524 | + >>> from canonical.launchpad.database.message import MessageSet |
525 | |
526 | >>> login('test@canonical.com') |
527 | |
528 | |
529 | === modified file 'lib/lp/registry/model/person.py' |
530 | --- lib/lp/registry/model/person.py 2010-11-04 17:52:48 +0000 |
531 | +++ lib/lp/registry/model/person.py 2010-11-11 00:10:33 +0000 |
532 | @@ -4032,7 +4032,7 @@ |
533 | |
534 | def cacheBrandingForPeople(self, people): |
535 | """See `IPersonSet`.""" |
536 | - from canonical.launchpad.database import LibraryFileAlias |
537 | + from canonical.launchpad.database.librarian import LibraryFileAlias |
538 | aliases = [] |
539 | aliases.extend(person.iconID for person in people |
540 | if person.iconID is not None) |
541 | |
542 | === modified file 'lib/lp/registry/stories/gpg-coc/01-claimgpg.txt' |
543 | --- lib/lp/registry/stories/gpg-coc/01-claimgpg.txt 2010-10-18 22:24:59 +0000 |
544 | +++ lib/lp/registry/stories/gpg-coc/01-claimgpg.txt 2010-11-11 00:10:33 +0000 |
545 | @@ -220,7 +220,7 @@ |
546 | >>> nothing, token_value = token_url.split('http://launchpad.dev/token/') |
547 | |
548 | >>> import pytz, datetime |
549 | - >>> from canonical.launchpad.database import LoginToken |
550 | + >>> from canonical.launchpad.database.logintoken import LoginToken |
551 | >>> logintoken = LoginToken.selectOneBy(token=token_value) |
552 | >>> logintoken.date_created = datetime.datetime( |
553 | ... 2005,04,01, 12,00,00, tzinfo=pytz.timezone('UTC')) |
554 | |
555 | === modified file 'lib/lp/registry/stories/mailinglists/hosted-email-address.txt' |
556 | --- lib/lp/registry/stories/mailinglists/hosted-email-address.txt 2009-08-29 03:14:48 +0000 |
557 | +++ lib/lp/registry/stories/mailinglists/hosted-email-address.txt 2010-11-11 00:10:33 +0000 |
558 | @@ -11,7 +11,7 @@ |
559 | >>> logout() |
560 | >>> transaction.commit() |
561 | |
562 | - >>> from canonical.launchpad.database import EmailAddressSet |
563 | + >>> from canonical.launchpad.database.emailaddress import EmailAddressSet |
564 | >>> email_set = EmailAddressSet() |
565 | >>> email_set.getByEmail(mailing_list.address) |
566 | <EmailAddress at... |
567 | |
568 | === modified file 'lib/lp/services/worlddata/model/language.py' |
569 | --- lib/lp/services/worlddata/model/language.py 2010-10-23 16:45:43 +0000 |
570 | +++ lib/lp/services/worlddata/model/language.py 2010-11-11 00:10:33 +0000 |
571 | @@ -34,6 +34,10 @@ |
572 | TextDirection, |
573 | ) |
574 | |
575 | +# XXX: JonathanLange 2010-11-10 bug=673796: It turns out this module is |
576 | +# unusable without spokenin being imported first. So, import spokenin. |
577 | +from lp.services.worlddata.model.spokenin import SpokenIn |
578 | +SpokenIn |
579 | |
580 | class Language(SQLBase): |
581 | implements(ILanguage) |
582 | |
583 | === modified file 'lib/lp/soyuz/browser/tests/distroseriesqueue-views.txt' |
584 | --- lib/lp/soyuz/browser/tests/distroseriesqueue-views.txt 2010-10-18 22:24:59 +0000 |
585 | +++ lib/lp/soyuz/browser/tests/distroseriesqueue-views.txt 2010-11-11 00:10:33 +0000 |
586 | @@ -6,7 +6,7 @@ |
587 | Let's instantiate the view for +queue for anonymous access: |
588 | |
589 | >>> from zope.component import queryMultiAdapter |
590 | - >>> from canonical.launchpad.database import LibraryFileAlias |
591 | + >>> from canonical.launchpad.database.librarian import LibraryFileAlias |
592 | >>> from canonical.launchpad.webapp.servers import LaunchpadTestRequest |
593 | >>> from lp.registry.interfaces.distribution import IDistributionSet |
594 | >>> fake_chroot = LibraryFileAlias.get(1) |
595 | |
596 | === modified file 'lib/lp/soyuz/doc/package-diff.txt' |
597 | --- lib/lp/soyuz/doc/package-diff.txt 2010-10-18 22:24:59 +0000 |
598 | +++ lib/lp/soyuz/doc/package-diff.txt 2010-11-11 00:10:33 +0000 |
599 | @@ -116,7 +116,7 @@ |
600 | |
601 | >>> from lp.soyuz.model.component import ( |
602 | ... ComponentSelection) |
603 | - >>> from canonical.launchpad.database import LibraryFileAlias |
604 | + >>> from canonical.launchpad.database.librarian import LibraryFileAlias |
605 | >>> from lp.soyuz.interfaces.component import IComponentSet |
606 | |
607 | >>> hoary = ubuntu.getSeries('hoary') |
608 | |
609 | === modified file 'lib/lp/soyuz/doc/soyuz-set-of-uploads.txt' |
610 | --- lib/lp/soyuz/doc/soyuz-set-of-uploads.txt 2010-11-11 00:10:29 +0000 |
611 | +++ lib/lp/soyuz/doc/soyuz-set-of-uploads.txt 2010-11-11 00:10:33 +0000 |
612 | @@ -75,7 +75,7 @@ |
613 | >>> from lp.soyuz.enums import PackageUploadStatus |
614 | >>> from lp.soyuz.scripts.initialise_distroseries import ( |
615 | ... InitialiseDistroSeries) |
616 | - >>> from canonical.launchpad.database import LibraryFileAlias |
617 | + >>> from canonical.launchpad.database.librarian import LibraryFileAlias |
618 | >>> ubuntu = Distribution.byName('ubuntu') |
619 | >>> breezy_autotest = ubuntu['breezy-autotest'] |
620 | >>> ubuntutest = Distribution.byName('ubuntutest') |
621 | |
622 | === modified file 'lib/lp/soyuz/stories/ppa/xx-ppa-files.txt' |
623 | --- lib/lp/soyuz/stories/ppa/xx-ppa-files.txt 2010-10-18 22:24:59 +0000 |
624 | +++ lib/lp/soyuz/stories/ppa/xx-ppa-files.txt 2010-11-11 00:10:33 +0000 |
625 | @@ -405,7 +405,6 @@ |
626 | |
627 | # Attach an existing file (the 'test-pkg_1.0.dsc') to a deleted |
628 | # LibraryFileContent. |
629 | - >>> from canonical.launchpad.database import LibraryFileContent |
630 | >>> from canonical.launchpad.webapp.interfaces import ( |
631 | ... IStoreSelector, MAIN_STORE, MASTER_FLAVOR) |
632 | >>> login('foo.bar@canonical.com') |
633 | |
634 | === modified file 'lib/lp/soyuz/tests/soyuz.py' |
635 | --- lib/lp/soyuz/tests/soyuz.py 2010-10-04 19:50:45 +0000 |
636 | +++ lib/lp/soyuz/tests/soyuz.py 2010-11-11 00:10:33 +0000 |
637 | @@ -15,7 +15,7 @@ |
638 | from zope.component import getUtility |
639 | |
640 | from canonical.config import config |
641 | -from canonical.launchpad.database import LibraryFileAlias |
642 | +from canonical.launchpad.database.librarian import LibraryFileAlias |
643 | from canonical.launchpad.ftests import ( |
644 | import_public_test_keys, |
645 | syncUpdate, |
646 | |
647 | === modified file 'lib/lp/soyuz/tests/test_doc.py' |
648 | --- lib/lp/soyuz/tests/test_doc.py 2010-10-27 14:25:19 +0000 |
649 | +++ lib/lp/soyuz/tests/test_doc.py 2010-11-11 00:10:33 +0000 |
650 | @@ -45,7 +45,7 @@ |
651 | code that did not use the ValidPersonOrTeamCache to determine |
652 | validity. |
653 | """ |
654 | - from canonical.launchpad.database import EmailAddress |
655 | + from canonical.launchpad.database.emailaddress import EmailAddress |
656 | from canonical.launchpad.interfaces.emailaddress import EmailAddressStatus |
657 | stevea_emailaddress = EmailAddress.byEmail( |
658 | 'steve.alexander@ubuntulinux.com') |
659 | |
660 | === modified file 'lib/lp/translations/doc/pofile.txt' |
661 | --- lib/lp/translations/doc/pofile.txt 2010-11-08 08:38:21 +0000 |
662 | +++ lib/lp/translations/doc/pofile.txt 2010-11-11 00:10:33 +0000 |
663 | @@ -874,8 +874,8 @@ |
664 | contributed translations on a given language for that distroseries, you |
665 | can use the getPOFileContributorsByLanguage() method of IDistroSeries. |
666 | |
667 | - >>> from canonical.launchpad.database import Language |
668 | >>> from lp.registry.model.distroseries import DistroSeries |
669 | + >>> from lp.services.worlddata.model.language import Language |
670 | >>> hoary = DistroSeries.selectOneBy(name="hoary") |
671 | >>> spanish = Language.selectOneBy(code="es") |
672 | >>> print_names(hoary.getPOFileContributorsByLanguage(spanish)) |
673 | |
674 | === modified file 'scripts/branch-rewrite.py' |
675 | --- scripts/branch-rewrite.py 2010-09-27 04:20:23 +0000 |
676 | +++ scripts/branch-rewrite.py 2010-11-11 00:10:33 +0000 |
677 | @@ -17,10 +17,6 @@ |
678 | import os |
679 | import sys |
680 | |
681 | -# XXX, MichaelHudson, 2009-07-22, bug=402845: This pointless import avoids a |
682 | -# circular import killing us. |
683 | -from canonical.launchpad.database import account |
684 | - |
685 | from canonical.database.sqlbase import ISOLATION_LEVEL_AUTOCOMMIT |
686 | from canonical.config import config |
687 | from lp.codehosting.rewrite import BranchRewriter |
Happy to fix things post-merge.