Merge lp:~stevenk/launchpad/drs-for-getsourcesfordeletion into lp:launchpad

Proposed by Steve Kowalik on 2013-07-22
Status: Merged
Approved by: Steve Kowalik on 2013-07-22
Approved revision: no longer in the source branch.
Merged at revision: 16699
Proposed branch: lp:~stevenk/launchpad/drs-for-getsourcesfordeletion
Merge into: lp:launchpad
Diff against target: 16 lines (+4/-2)
1 file modified
lib/lp/soyuz/model/archive.py (+4/-2)
To merge this branch: bzr merge lp:~stevenk/launchpad/drs-for-getsourcesfordeletion
Reviewer Review Type Date Requested Status
Steve Kowalik (community) code Approve on 2013-07-22
Review via email: mp+176149@code.launchpad.net

Description of the change

Rather than calling load_related() for every single source publication in IArchive.getSourcesForDeletion(), make use of DecoratedResultSet instead.

To post a comment you must log in.
Steve Kowalik (stevenk) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/soyuz/model/archive.py'
2--- lib/lp/soyuz/model/archive.py 2013-07-16 08:10:32 +0000
3+++ lib/lp/soyuz/model/archive.py 2013-07-22 09:48:30 +0000
4@@ -628,8 +628,10 @@
5 SourcePackagePublishingHistory, *clauses).order_by(
6 SourcePackageName.name, Desc(SourcePackageRelease.version),
7 Desc(SourcePackagePublishingHistory.id))
8- load_related(SourcePackageRelease, sources, ['sourcepackagereleaseID'])
9- return sources
10+ def eager_load(rows):
11+ load_related(
12+ SourcePackageRelease, rows, ['sourcepackagereleaseID'])
13+ return DecoratedResultSet(sources, pre_iter_hook=eager_load)
14
15 @property
16 def number_of_sources(self):