~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/browser/queue.py

  • Committer: Jeroen Vermeulen
  • Date: 2011-07-28 07:59:23 UTC
  • mto: This revision was merged to the branch mainline in revision 13547.
  • Revision ID: jeroen.vermeulen@canonical.com-20110728075923-q25rg80h0jbmhit3
Show details for sync uploads.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
    load_referencing,
28
28
    load_related,
29
29
    )
 
30
from lp.services.job.model.job import Job
30
31
from lp.soyuz.enums import (
31
32
    PackagePublishingPriority,
32
33
    PackageUploadStatus,
190
191
        return getUtility(IPackagesetSet).getForPackages(
191
192
            self.context, set(spr.sourcepackagenameID for spr in sprs))
192
193
 
 
194
    def loadPackageCopyJobs(self, uploads):
 
195
        """Batch-load `PackageCopyJob`s and related information."""
 
196
        # Avoid circular imports.
 
197
        from lp.registry.model.person import Person
 
198
        from lp.soyuz.model.archive import Archive
 
199
        from lp.soyuz.model.packagecopyjob import PackageCopyJob
 
200
 
 
201
        package_copy_jobs = load_related(
 
202
            PackageCopyJob, uploads, ['package_copy_job_id'])
 
203
        load_related(Archive, package_copy_jobs, ['source_archive_id'])
 
204
        jobs = load_related(Job, package_copy_jobs, ['job_id'])
 
205
        load_related(Person, jobs, ['requester_id'])
 
206
 
193
207
    def decoratedQueueBatch(self):
194
208
        """Return the current batch, converted to decorated objects.
195
209
 
245
259
 
246
260
        package_sets = self.getPackagesetsFor(source_sprs)
247
261
 
 
262
        self.loadPackageCopyJobs(uploads)
 
263
 
248
264
        return [
249
265
            CompletePackageUpload(
250
266
                item, build_upload_files, source_upload_files, package_sets)