~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-06-10 19:18:44 UTC
  • mfrom: (13175.2.3 bug-735991)
  • Revision ID: launchpad@pqm.canonical.com-20110610191844-wo6ryjj31ooqr3aa
[r=bac][bug=735991] more efficient implementation of
        Person.getBugSubscriberPackages();
        call canonical_url(self.context) exactly once when ~person/+packagebugs
        is rendered.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2009-2011 Canonical Ltd.  This software is licensed under the
 
1
# Copyright 2009 Canonical Ltd.  This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
3
 
4
4
"""Browser views for package queue."""
34
34
    ISourcePackageReleaseFileSet,
35
35
    )
36
36
from lp.soyuz.interfaces.packageset import IPackagesetSet
37
 
from lp.soyuz.interfaces.publishing import name_priority_map
 
37
from lp.soyuz.interfaces.publishing import (
 
38
    name_priority_map,
 
39
    )
38
40
from lp.soyuz.interfaces.queue import (
39
41
    IPackageUpload,
40
42
    IPackageUploadSet,
157
159
                pkg_upload_source.sourcepackagerelease.id] = pkg_upload_source
158
160
        return package_upload_source_dict
159
161
 
160
 
    def source_files_dict(self, package_upload_source_dict, source_files):
 
162
    def source_fies_dict(self, package_upload_source_dict, source_files):
161
163
        """Return a dictionary of source files keyed on PackageUpload ID."""
162
164
        source_upload_files = {}
163
165
        for source_file in source_files:
213
215
        # Get a dictionary of lists of source files keyed by upload ID.
214
216
        package_upload_source_dict = self.source_dict(
215
217
            upload_ids, source_files)
216
 
        source_upload_files = self.source_files_dict(
 
218
        source_upload_files = self.source_fies_dict(
217
219
            package_upload_source_dict, source_files)
218
220
 
219
221
        # Get a list of binary package names that already exist in
222
224
        self.old_binary_packages = self.calculateOldBinaries(
223
225
            binary_package_names)
224
226
 
225
 
        return [
226
 
            CompletePackageUpload(
227
 
                item, build_upload_files, source_upload_files)
228
 
            for item in uploads]
 
227
        return [CompletePackageUpload(item, build_upload_files,
 
228
                                      source_upload_files)
 
229
                for item in uploads]
229
230
 
230
231
    def is_new(self, binarypackagerelease):
231
232
        """Return True if the binarypackagerelease has no ancestry."""
321
322
        queue_set = getUtility(IPackageUploadSet)
322
323
 
323
324
        if accept:
 
325
            header = 'Accepting Results:\n'
324
326
            action = "accept"
325
327
        elif reject:
 
328
            header = 'Rejecting Results:\n'
326
329
            action = "reject"
327
330
 
328
331
        success = []
355
358
                continue
356
359
 
357
360
            feedback_interpolations = {
358
 
                "name": queue_item.displayname,
359
 
                "component": "(unchanged)",
360
 
                "section": "(unchanged)",
361
 
                "priority": "(unchanged)",
 
361
                "name"      : queue_item.displayname,
 
362
                "component" : "(unchanged)",
 
363
                "section"   : "(unchanged)",
 
364
                "priority"  : "(unchanged)",
362
365
                }
363
366
            if new_component:
364
367
                feedback_interpolations['component'] = new_component.name
451
454
        # Create a dictionary of binary files keyed by
452
455
        # binarypackagerelease.
453
456
        self.binary_packages = {}
454
 
        for binary in build_upload_files.get(self.id, []):
455
 
            package = binary.binarypackagerelease
456
 
            self.binary_packages.setdefault(package, []).append(binary)
 
457
        self.binary_files = build_upload_files.get(self.id, None)
 
458
        if self.binary_files is not None:
 
459
            for binary in self.binary_files:
 
460
                package = binary.binarypackagerelease
 
461
                if package not in self.binary_packages:
 
462
                    self.binary_packages[package] = []
 
463
                self.binary_packages[package].append(binary)
457
464
 
458
465
        # Create a list of source files if this is a source upload.
459
466
        self.source_files = source_upload_files.get(self.id, None)
491
498
                self.sourcepackagerelease.sourcepackagename,
492
499
                distroseries=self.distroseries,
493
500
                direct_inclusion=True)))
 
501