Merge lp:~lifeless/launchpad/bug-731736 into lp:launchpad

Proposed by Robert Collins
Status: Merged
Approved by: Robert Collins
Approved revision: not available
Merged at revision: 12558
Proposed branch: lp:~lifeless/launchpad/bug-731736
Merge into: lp:launchpad
Diff against target: 75 lines (+9/-28)
3 files modified
lib/canonical/launchpad/database/temporaryblobstorage.py (+1/-7)
lib/canonical/launchpad/interfaces/temporaryblobstorage.py (+1/-5)
lib/canonical/launchpad/pagetests/webservice/xx-temporary-blob-storage.txt (+7/-16)
To merge this branch: bzr merge lp:~lifeless/launchpad/bug-731736
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
William Grant code* Approve
Review via email: mp+52634@code.launchpad.net

Commit message

Remove all db lookups in the /temporaryblobs collection - it should never have been iterable anyway.

Description of the change

Remove all db lookups in the /temporaryblobs collection - it should never have been iterable anyway.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (code*)
Revision history for this message
Robert Collins (lifeless) wrote :

oooh

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/database/temporaryblobstorage.py'
2--- lib/canonical/launchpad/database/temporaryblobstorage.py 2010-11-08 12:52:43 +0000
3+++ lib/canonical/launchpad/database/temporaryblobstorage.py 2011-03-09 04:54:41 +0000
4@@ -151,10 +151,4 @@
5
6 def default_temporary_blob_storage_list(self):
7 """See `ITemporaryStorageManager`."""
8- # Return the 50 most recent blobs.
9- store = IStore(TemporaryBlobStorage)
10- return store.find(
11- TemporaryBlobStorage,
12- TemporaryBlobStorage.file_alias == LibraryFileAlias.id,
13- LibraryFileAlias.expires > datetime.utcnow().replace(tzinfo=utc)
14- ).order_by(TemporaryBlobStorage.date_created)
15+ return []
16
17=== modified file 'lib/canonical/launchpad/interfaces/temporaryblobstorage.py'
18--- lib/canonical/launchpad/interfaces/temporaryblobstorage.py 2010-08-20 20:31:18 +0000
19+++ lib/canonical/launchpad/interfaces/temporaryblobstorage.py 2011-03-09 04:54:41 +0000
20@@ -91,8 +91,4 @@
21
22 @collection_default_content()
23 def default_temporary_blob_storage_list():
24- """Return the default list of `ITemporaryBlobStorage` objects.
25-
26- :returns: All the the `ITemporaryBlobStorage` blobs whose file
27- aliases have not expired.
28- """
29+ """Return an empty set - only exists to keep lazr.restful happy."""
30
31=== modified file 'lib/canonical/launchpad/pagetests/webservice/xx-temporary-blob-storage.txt'
32--- lib/canonical/launchpad/pagetests/webservice/xx-temporary-blob-storage.txt 2010-06-07 20:18:28 +0000
33+++ lib/canonical/launchpad/pagetests/webservice/xx-temporary-blob-storage.txt 2011-03-09 04:54:41 +0000
34@@ -2,15 +2,14 @@
35 ==========================
36
37 The set of temporary blobs in Launchpad is represented by the collection
38-found at /temporary-blobs. The collection contains all the temporary
39-blobs whose file aliases have not expired.
40+found at /temporary-blobs. The collection is always empty because there
41+is no use case for external iteration.
42
43 >>> temporary_blobs = webservice.get('/temporary-blobs').jsonBody()
44 >>> len(temporary_blobs['entries'])
45 0
46
47-If we add a new blob, it will show up in the temporary_blobs entries
48-set.
49+If we add a new blob, it will not show up in the temporary_blobs entries set.
50
51 >>> login('foo.bar@canonical.com')
52 >>> import os
53@@ -34,18 +33,10 @@
54
55 >>> temporary_blobs = webservice.get('/temporary-blobs').jsonBody()
56 >>> len(temporary_blobs['entries'])
57- 1
58-
59-Each of the entries in the temporary_blobs entries set is an
60-ITemporaryBlobStorage instance. A blob is identified by its UUID, which
61-is exported via the webservice as 'token', in keeping with how it's
62-referred to in the UI.
63-
64- >>> blob = temporary_blobs['entries'][0]
65- >>> blob['token'] == blob_token
66- True
67-
68-It's possible to fetch a blob directly using its token.
69+ 0
70+
71+It is however possible to fetch a blob directly using its token (so that apport
72+can tell when a bug is ready to file).
73
74 >>> blob_link = '/temporary-blobs/' + blob_token
75 >>> blob = webservice.get(blob_link).jsonBody()