← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/launchpad/post-394645 into lp:launchpad

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/post-394645 into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #394645 in Launchpad itself: "IDistroSeries.getQueueItems deprecated by IPackageUploadSet.getPackageUploads"
  https://bugs.launchpad.net/launchpad/+bug/394645
  Bug #537335 in Launchpad itself: "DistroSeries.getQueueItems is undocumented and fails to return ordered results"
  https://bugs.launchpad.net/launchpad/+bug/537335

For more details, see:
https://code.launchpad.net/~jtv/launchpad/post-394645/+merge/64826

= Summary =

DistroSeries.getQueueItems is no longer needed.  It has been superseded by DistroSeries.getPackageUploads.


== Proposed fix ==

This branch sweeps away all memories of getQueueItems.  The non-test uses had already been eradicated; this branch takes care of the remaining uses in tests, as well as mentions in interfaces, and the method itself.


== Pre-implementation notes ==

As discussed with Julian: this leaves the IHasQueueItems interface rather bare.  But instead of just putting getPackageUploads in there, it would make more sense to scan DistroSeries for other queue-related methods and move them all into a class of their own.  That also means less Soyuz-specific code in the Registry class.
 

== Implementation details ==

getPackageUploads is basically a drop-in replacement for getQueueItems, except that it sees some entries that the old method misses.  There was also a small incompatibility in parameter ordering that affected positional arguments lists, but I made the new method's signature conform to the old one.  Most call sites I simply ported over, but I deleted the doctest that formed essentially a unit test.  The new method has unit tests of its own, in a more current format.  Where in doubt, I left doctests in place as regression tests.

One larger difference between the two, which only really affects tests, is that the name and version filters of the new method only accept unicode, not classic str.


== Tests ==

Lots.  Basically run all Soyuz and packageuploader tests!


== Demo and Q/A ==

The +queue page and the queue.py script should still work as before.


= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/soyuz/scripts/initialize_distroseries.py
  lib/lp/soyuz/browser/tests/test_queue.py
  lib/lp/soyuz/templates/distroseries-queue.pt
  lib/lp/archiveuploader/tests/test_ppauploadprocessor.py
  lib/lp/soyuz/model/queue.py
  lib/lp/soyuz/doc/distroseriesqueue-translations.txt
  lib/lp/soyuz/interfaces/queue.py
  lib/lp/soyuz/scripts/tests/test_queue.py
  lib/lp/soyuz/browser/queue.py
  lib/lp/soyuz/model/packagecopyjob.py
  lib/lp/soyuz/scripts/processaccepted.py
  lib/lp/archiveuploader/tests/nascentupload-announcements.txt
  lib/lp/soyuz/doc/distroseriesqueue-ddtp-tarball.txt
  lib/lp/registry/interfaces/distroseries.py
  lib/lp/soyuz/doc/distroseriesqueue-dist-upgrader.txt
  lib/lp/soyuz/tests/test_packageupload.py
  lib/lp/archiveuploader/tests/test_uploadprocessor.py
  lib/lp/soyuz/doc/soyuz-upload.txt
  lib/lp/registry/model/distroseries.py
  lib/lp/soyuz/doc/soyuz-set-of-uploads.txt
  lib/lp/archiveuploader/tests/nascentupload.txt
  lib/lp/soyuz/scripts/queue.py
  lib/lp/soyuz/doc/distroseriesqueue.txt

./lib/lp/archiveuploader/tests/nascentupload-announcements.txt
     191: want exceeds 78 characters.
     192: want exceeds 78 characters.
     660: want exceeds 78 characters.
     727: want exceeds 78 characters.
     729: want exceeds 78 characters.
     775: want exceeds 78 characters.
     777: want exceeds 78 characters.
./lib/lp/soyuz/doc/distroseriesqueue-ddtp-tarball.txt
     162: want exceeds 78 characters.
     165: want exceeds 78 characters.
./lib/lp/soyuz/doc/distroseriesqueue-dist-upgrader.txt
     144: want exceeds 78 characters.
     147: want exceeds 78 characters.
./lib/lp/soyuz/doc/soyuz-upload.txt
     522: want exceeds 78 characters.
     523: want exceeds 78 characters.
     524: want exceeds 78 characters.
     620: want exceeds 78 characters.
     621: want exceeds 78 characters.
     622: want exceeds 78 characters.
     684: want exceeds 78 characters.
     687: want exceeds 78 characters.
     712: want exceeds 78 characters.
     713: want exceeds 78 characters.
     714: want exceeds 78 characters.
     715: want exceeds 78 characters.
./lib/lp/soyuz/doc/soyuz-set-of-uploads.txt
     718: want exceeds 78 characters.
     719: want exceeds 78 characters.
     747: want exceeds 78 characters.
-- 
https://code.launchpad.net/~jtv/launchpad/post-394645/+merge/64826
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/post-394645 into lp:launchpad.
=== modified file 'lib/lp/archiveuploader/tests/nascentupload-announcements.txt'
--- lib/lp/archiveuploader/tests/nascentupload-announcements.txt	2011-06-01 04:57:27 +0000
+++ lib/lp/archiveuploader/tests/nascentupload-announcements.txt	2011-06-16 13:33:24 +0000
@@ -643,7 +643,7 @@
 dry_run, which when True will not send any emails.  It will also log at
 the INFO level what it /would/ have sent.
 
-    >>> random_package_upload = hoary.getQueueItems()[0]
+    >>> random_package_upload = hoary.getPackageUploads()[0]
     >>> random_package_upload.notify(dry_run=True, logger=FakeLogger())
     DEBUG Building recipients list.
     ...

=== modified file 'lib/lp/archiveuploader/tests/nascentupload.txt'
--- lib/lp/archiveuploader/tests/nascentupload.txt	2011-06-15 09:49:37 +0000
+++ lib/lp/archiveuploader/tests/nascentupload.txt	2011-06-16 13:33:24 +0000
@@ -495,8 +495,8 @@
     REJECTED
 
     >>> from lp.soyuz.enums import PackageUploadStatus
-    >>> hoary.getQueueItems(
-    ...     status=PackageUploadStatus.REJECTED, name="ed").count()
+    >>> hoary.getPackageUploads(
+    ...     status=PackageUploadStatus.REJECTED, name=u"ed").count()
     1
 
 
@@ -720,8 +720,8 @@
 content, it should have all the required fields except the
 'dsc_standards_version':
 
-    >>> inst_queue = hoary.getQueueItems(
-    ...     PackageUploadStatus.NEW, name='test75874', exact_match=True)[0]
+    >>> inst_queue = hoary.getPackageUploads(
+    ...     PackageUploadStatus.NEW, name=u'test75874', exact_match=True)[0]
     >>> inst_spr = inst_queue.sources[0].sourcepackagerelease
 
     >>> inst_spr.dsc_maintainer_rfc822

=== modified file 'lib/lp/archiveuploader/tests/test_ppauploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_ppauploadprocessor.py	2011-06-15 09:49:37 +0000
+++ lib/lp/archiveuploader/tests/test_ppauploadprocessor.py	2011-06-16 13:33:24 +0000
@@ -191,9 +191,9 @@
             self.uploadprocessor.last_processed_upload.queue_root.status,
             PackageUploadStatus.DONE)
 
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.DONE, name="bar",
-            version="1.0-1", exact_match=True, archive=self.name16.archive)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.DONE, name=u"bar",
+            version=u"1.0-1", exact_match=True, archive=self.name16.archive)
         self.assertEqual(queue_items.count(), 1)
 
         [queue_item] = queue_items
@@ -360,9 +360,9 @@
                          "Unexpected email generated on binary upload.")
 
         # Publish the binary.
-        [queue_item] = self.breezy.getQueueItems(
-            status=PackageUploadStatus.ACCEPTED, name="bar",
-            version="1.0-1", exact_match=True, archive=self.name16.archive)
+        [queue_item] = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.ACCEPTED, name=u"bar",
+            version=u"1.0-1", exact_match=True, archive=self.name16.archive)
         queue_item.realiseUpload()
 
         for binary_package in build.binarypackages:
@@ -404,9 +404,9 @@
             self.build_uploadprocessor, upload_dir, build=build)
 
         # The binary upload was accepted and it's waiting in the queue.
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.ACCEPTED, name="bar",
-            version="1.0-1", exact_match=True, archive=self.name16.archive)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.ACCEPTED, name=u"bar",
+            version=u"1.0-1", exact_match=True, archive=self.name16.archive)
         self.assertEqual(queue_items.count(), 1)
 
         # All the files associated with this binary upload must be in the
@@ -458,9 +458,9 @@
             self.build_uploadprocessor, upload_dir, build=build_bar_i386)
 
         # The binary upload was accepted and it's waiting in the queue.
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.ACCEPTED, name="bar",
-            version="1.0-1", exact_match=True, archive=cprov.archive)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.ACCEPTED, name=u"bar",
+            version=u"1.0-1", exact_match=True, archive=cprov.archive)
         self.assertEqual(queue_items.count(), 1)
 
     def testUploadDoesNotEmailMaintainerOrChangedBy(self):
@@ -533,9 +533,9 @@
             self.uploadprocessor.last_processed_upload.queue_root.status,
             PackageUploadStatus.DONE)
 
-        queue_items = hoary.getQueueItems(
-            status=PackageUploadStatus.DONE, name="bar",
-            version="1.0-1", exact_match=True, archive=self.name16.archive)
+        queue_items = hoary.getPackageUploads(
+            status=PackageUploadStatus.DONE, name=u"bar",
+            version=u"1.0-1", exact_match=True, archive=self.name16.archive)
         self.assertEqual(queue_items.count(), 1)
 
         [queue_item] = queue_items
@@ -565,9 +565,9 @@
             self.uploadprocessor.last_processed_upload.queue_root.status,
             PackageUploadStatus.DONE)
 
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.DONE, name="bar",
-            version="1.0-1", exact_match=True, archive=ubuntu_team.archive)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.DONE, name=u"bar",
+            version=u"1.0-1", exact_match=True, archive=ubuntu_team.archive)
         self.assertEqual(queue_items.count(), 1)
 
         pending_ppas = self.ubuntu.getPendingPublicationPPAs()
@@ -670,8 +670,8 @@
             test_files_dir=test_files_dir)
         self.processUpload(self.uploadprocessor, upload_dir)
 
-        queue_items = self.breezy.getQueueItems(
-            name="debian-installer",
+        queue_items = self.breezy.getPackageUploads(
+            name=u"debian-installer",
             status=PackageUploadStatus.ACCEPTED,
             archive=self.name16.archive)
         self.assertEqual(queue_items.count(), 1)
@@ -709,9 +709,9 @@
         upload_dir = self.queueUpload("bar_1.0-1", "~name16/ubuntu")
         self.processUpload(self.uploadprocessor, upload_dir)
 
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.DONE, name="bar",
-            version="1.0-1", exact_match=True, archive=self.name16.archive)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.DONE, name=u"bar",
+            version=u"1.0-1", exact_match=True, archive=self.name16.archive)
         self.assertEqual(queue_items.count(), 1)
 
         [queue_item] = queue_items
@@ -726,9 +726,9 @@
             self.build_uploadprocessor, upload_dir, build=build)
 
         # The binary upload was accepted and it's waiting in the queue.
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.ACCEPTED, name="bar",
-            version="1.0-1", exact_match=True, archive=self.name16.archive)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.ACCEPTED, name=u"bar",
+            version=u"1.0-1", exact_match=True, archive=self.name16.archive)
         self.assertEqual(queue_items.count(), 1)
 
         # All the files associated with this binary upload must be in the
@@ -750,9 +750,9 @@
         upload_dir = self.queueUpload(
             "bar_1.0-1_contrib_component", "~name16/ubuntu")
         self.processUpload(self.uploadprocessor, upload_dir)
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.DONE, name="bar",
-            version="1.0-1", exact_match=True, archive=self.name16.archive)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.DONE, name=u"bar",
+            version=u"1.0-1", exact_match=True, archive=self.name16.archive)
 
         # The upload was accepted despite the fact that it does
         # not have a valid component:
@@ -769,9 +769,9 @@
             "bar_1.0-1_contrib_binary", "~name16/ubuntu")
         self.processUpload(
             self.build_uploadprocessor, upload_dir, build=build)
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.ACCEPTED, name="bar",
-            version="1.0-1", exact_match=True, archive=self.name16.archive)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.ACCEPTED, name=u"bar",
+            version=u"1.0-1", exact_match=True, archive=self.name16.archive)
 
         # The binary is accepted despite the fact that it does not have
         # a valid component:
@@ -880,9 +880,9 @@
             self.uploadprocessor.last_processed_upload.queue_root.status,
             PackageUploadStatus.NEW)
 
-        [queue_item] = self.breezy.getQueueItems(
-            status=PackageUploadStatus.NEW, name="bar",
-            version="1.0-1", exact_match=True)
+        [queue_item] = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u"bar",
+            version=u"1.0-1", exact_match=True)
         queue_item.setAccepted()
         queue_item.realiseUpload()
         self.layer.commit()
@@ -1159,9 +1159,9 @@
             self.uploadprocessor.last_processed_upload.queue_root.status,
             PackageUploadStatus.NEW)
 
-        [queue_item] = self.breezy.getQueueItems(
-            status=PackageUploadStatus.NEW, name="bar",
-            version="1.0-1", exact_match=True)
+        [queue_item] = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u"bar",
+            version=u"1.0-1", exact_match=True)
         queue_item.setAccepted()
         queue_item.realiseUpload()
         self.layer.commit()
@@ -1301,9 +1301,9 @@
             self.build_uploadprocessor, upload_dir, build=build)
 
         # The binary upload was accepted, and it's waiting in the queue.
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.ACCEPTED, name="bar",
-            version="1.0-1", exact_match=True, archive=self.name16.archive)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.ACCEPTED, name=u"bar",
+            version=u"1.0-1", exact_match=True, archive=self.name16.archive)
         self.assertEqual(queue_items.count(), 1)
 
     def testArchiveBinarySize(self):

=== modified file 'lib/lp/archiveuploader/tests/test_uploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_uploadprocessor.py	2011-06-15 09:49:37 +0000
+++ lib/lp/archiveuploader/tests/test_uploadprocessor.py	2011-06-16 13:33:24 +0000
@@ -165,10 +165,12 @@
             self.options.nomails, builds, self.options.keep, getPolicy, txn,
             self.log)
 
-    def publishPackage(self, packagename, version, source=True,
-                        archive=None):
+    def publishPackage(self, packagename, version, source=True, archive=None):
         """Publish a single package that is currently NEW in the queue."""
-        queue_items = self.breezy.getQueueItems(
+        packagename = unicode(packagename)
+        if version is not None:
+            version = unicode(version)
+        queue_items = self.breezy.getPackageUploads(
             status=PackageUploadStatus.NEW, name=packagename,
             version=version, exact_match=True, archive=archive)
         self.assertEqual(queue_items.count(), 1)
@@ -589,9 +591,9 @@
         # Accept and publish the upload.
         # This is required so that the next upload of a later version of
         # the same package will work correctly.
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.NEW, name="bar",
-            version="1.0-1", exact_match=True)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u"bar",
+            version=u"1.0-1", exact_match=True)
         self.assertEqual(queue_items.count(), 1)
         queue_item = queue_items[0]
 
@@ -619,9 +621,9 @@
                         "Got:\n%s" % raw_msg)
 
         # And verify that the queue item is in the unapproved state.
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.UNAPPROVED, name="bar",
-            version="1.0-2", exact_match=True)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.UNAPPROVED, name=u"bar",
+            version=u"1.0-2", exact_match=True)
         self.assertEqual(queue_items.count(), 1)
         queue_item = queue_items[0]
         self.assertEqual(
@@ -649,10 +651,10 @@
         [bar_original_build] = bar_source_pub.createMissingBuilds()
 
         # Move the source from the accepted queue.
-        [queue_item] = self.breezy.getQueueItems(
+        [queue_item] = self.breezy.getPackageUploads(
             status=PackageUploadStatus.ACCEPTED,
-            version="1.0-1",
-            name="bar")
+            version=u"1.0-1",
+            name=u"bar")
         queue_item.setDone()
 
         # Upload and accept a binary for the primary archive source.
@@ -702,10 +704,10 @@
 
         # The upload should also be auto-accepted even though there's no
         # ancestry.  This means items should go to ACCEPTED and not NEW.
-        queue_items = self.breezy.getQueueItems(
+        queue_items = self.breezy.getPackageUploads(
             status=PackageUploadStatus.ACCEPTED,
-            version="1.0-1",
-            name="bar",
+            version=u"1.0-1",
+            name=u"bar",
             archive=copy_archive)
         self.assertEqual(
             queue_items.count(), 1,
@@ -795,9 +797,9 @@
         upload_dir = self.queueUpload("bar_1.0-1_binary")
         self.processUpload(build_uploadprocessor, upload_dir,
             build=bar_copied_build)
-        [duplicated_binary_upload] = breezy_autotest.getQueueItems(
-            status=PackageUploadStatus.NEW, name='bar',
-            version='1.0-1', exact_match=True)
+        [duplicated_binary_upload] = breezy_autotest.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u'bar',
+            version=u'1.0-1', exact_match=True)
 
         # The just uploaded binary cannot be accepted because its
         # filename 'bar_1.0-1_i386.deb' is already published in the
@@ -927,9 +929,9 @@
             uploadprocessor.last_processed_upload.queue_root.status,
             PackageUploadStatus.NEW)
 
-        [queue_item] = self.breezy.getQueueItems(
-            status=PackageUploadStatus.NEW, name="foocomm",
-            version="1.0-1", exact_match=True)
+        [queue_item] = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u"foocomm",
+            version=u"1.0-1", exact_match=True)
         queue_item.setAccepted()
         queue_item.realiseUpload()
         self.layer.commit()
@@ -1091,10 +1093,10 @@
 
         # Check the upload is in the DONE queue since single source uploads
         # with ancestry (previously uploaded) will skip the ACCEPTED state.
-        queue_items = self.breezy.getQueueItems(
+        queue_items = self.breezy.getPackageUploads(
             status=PackageUploadStatus.DONE,
-            version="1.0-2",
-            name="foocomm")
+            version=u"1.0-2",
+            name=u"foocomm")
         self.assertEqual(queue_items.count(), 1)
 
         # Single source uploads also get their corrsponding builds created
@@ -1114,10 +1116,10 @@
         self.processUpload(uploadprocessor, upload_dir)
 
         # Check that the binary upload was accepted:
-        queue_items = self.breezy.getQueueItems(
+        queue_items = self.breezy.getPackageUploads(
             status=PackageUploadStatus.ACCEPTED,
-            version="1.0-2",
-            name="foocomm")
+            version=u"1.0-2",
+            name=u"foocomm")
         self.assertEqual(queue_items.count(), 1)
 
     def testPartnerUploadToProposedPocket(self):
@@ -1276,9 +1278,9 @@
         upload_dir = self.queueUpload(upload_dir_name)
         self.processUpload(uploadprocessor, upload_dir)
 
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.NEW, name="bar",
-            version="1.0-1", exact_match=True)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u"bar",
+            version=u"1.0-1", exact_match=True)
         [queue_item] = queue_items
         self.assertEqual(
             queue_item.sourcepackagerelease.component.name,
@@ -1391,9 +1393,9 @@
             "Expected no emails!  Actually got:\n%s" % raw_msg)
 
         # Check in the queue to see if it really made it:
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.NEW, name="bar",
-            version="1.0-1", exact_match=True)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u"bar",
+            version=u"1.0-1", exact_match=True)
         self.assertEqual(
             queue_items.count(), 1,
             "Expected one 'bar' item in the queue, actually got %d."
@@ -1822,9 +1824,9 @@
         upload_dir = self.queueUpload("bar_1.0-1")
         self.processUpload(uploadprocessor, upload_dir)
         # ACCEPT the upload
-        queue_items = self.breezy.getQueueItems(
-            status=PackageUploadStatus.NEW, name="bar",
-            version="1.0-1", exact_match=True)
+        queue_items = self.breezy.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u"bar",
+            version=u"1.0-1", exact_match=True)
         self.assertEqual(queue_items.count(), 1)
         queue_item = queue_items[0]
         queue_item.setAccepted()
@@ -1882,9 +1884,9 @@
         [build] = source_pub.createMissingBuilds()
 
         # Move the source from the accepted queue.
-        [queue_item] = self.breezy.getQueueItems(
+        [queue_item] = self.breezy.getPackageUploads(
             status=PackageUploadStatus.ACCEPTED,
-            version="1.0-1", name="bar")
+            version=u"1.0-1", name=u"bar")
         queue_item.setDone()
 
         builder = self.factory.makeBuilder()
@@ -1926,9 +1928,9 @@
         [build] = source_pub.createMissingBuilds()
 
         # Move the source from the accepted queue.
-        [queue_item] = self.breezy.getQueueItems(
+        [queue_item] = self.breezy.getPackageUploads(
             status=PackageUploadStatus.ACCEPTED,
-            version="1.0-1", name="bar")
+            version=u"1.0-1", name=u"bar")
         queue_item.setDone()
 
         build.buildqueue_record.markAsBuilding(self.factory.makeBuilder())
@@ -2088,9 +2090,9 @@
         [build] = source_pub.createMissingBuilds()
 
         # Move the source from the accepted queue.
-        [queue_item] = self.breezy.getQueueItems(
+        [queue_item] = self.breezy.getPackageUploads(
             status=PackageUploadStatus.ACCEPTED,
-            version="1.0-1", name="bar")
+            version=u"1.0-1", name=u"bar")
         queue_item.setDone()
 
         build.buildqueue_record.markAsBuilding(self.factory.makeBuilder())

=== modified file 'lib/lp/registry/interfaces/distroseries.py'
--- lib/lp/registry/interfaces/distroseries.py	2011-06-15 02:37:35 +0000
+++ lib/lp/registry/interfaces/distroseries.py	2011-06-16 13:33:24 +0000
@@ -530,14 +530,15 @@
     # Really IPackageUpload, patched in _schema_circular_imports.py
     @operation_returns_collection_of(Interface)
     @export_read_operation()
-    def getPackageUploads(created_since_date=None, status=None, archive=None,
+    def getPackageUploads(status=None, created_since_date=None, archive=None,
                           pocket=None, custom_type=None, name=None,
                           version=None, exact_match=False):
         """Get package upload records for this distribution series.
 
+        :param status: Filter results by this `PackageUploadStatus`, or list
+            of `PackageUploadStatus`es.
         :param created_since_date: If specified, only returns items uploaded
             since the timestamp supplied.
-        :param status: Filter results by this `PackageUploadStatus`
         :param archive: Filter results for this `IArchive`
         :param pocket: Filter results by this `PackagePublishingPocket`
         :param custom_type: Filter results by this `PackageUploadCustomFormat`

=== modified file 'lib/lp/registry/model/distroseries.py'
--- lib/lp/registry/model/distroseries.py	2011-06-15 02:37:35 +0000
+++ lib/lp/registry/model/distroseries.py	2011-06-16 13:33:24 +0000
@@ -1642,7 +1642,7 @@
         """See `IDistroSeries`."""
         return PackageUploadQueue(self, state)
 
-    def getPackageUploads(self, created_since_date=None, status=None,
+    def getPackageUploads(self, status=None, created_since_date=None,
                           archive=None, pocket=None, custom_type=None,
                           name=None, version=None, exact_match=False):
         """See `IDistroSeries`."""
@@ -1650,157 +1650,6 @@
             self, created_since_date, status, archive, pocket, custom_type,
             name=name, version=version, exact_match=exact_match)
 
-    def getQueueItems(self, status=None, name=None, version=None,
-                      exact_match=False, pocket=None, archive=None):
-        """See `IDistroSeries`."""
-        # XXX Julian 2009-07-02 bug=394645
-        # This method is partially deprecated by getPackageUploads(),
-        # see the bug for more info.
-
-        default_clauses = ["""
-            packageupload.distroseries = %s""" % sqlvalues(self)]
-
-        # Restrict result to given archives.
-        archives = self.distribution.getArchiveIDList(archive)
-
-        default_clauses.append("""
-        packageupload.archive IN %s""" % sqlvalues(archives))
-
-        # restrict result to a given pocket
-        if pocket is not None:
-            if not isinstance(pocket, list):
-                pocket = [pocket]
-            default_clauses.append("""
-            packageupload.pocket IN %s""" % sqlvalues(pocket))
-
-        # XXX cprov 2006-06-06:
-        # We may reorganise this code, creating some new methods provided
-        # by IPackageUploadSet, as: getByStatus and getByName.
-        if not status:
-            assert not version and not exact_match
-            return PackageUpload.select(
-                " AND ".join(default_clauses), orderBy=['-id'])
-
-        if not isinstance(status, list):
-            status = [status]
-
-        default_clauses.append("""
-        packageupload.status IN %s""" % sqlvalues(status))
-
-        if not name:
-            assert not version and not exact_match
-            return PackageUpload.select(
-                " AND ".join(default_clauses), orderBy=['-id'])
-
-        source_where_clauses = default_clauses + ["""
-            packageupload.id = packageuploadsource.packageupload
-            """]
-
-        build_where_clauses = default_clauses + ["""
-            packageupload.id = packageuploadbuild.packageupload
-            """]
-
-        custom_where_clauses = default_clauses + ["""
-            packageupload.id = packageuploadcustom.packageupload
-            """]
-
-        # modify source clause to lookup on sourcepackagerelease
-        source_where_clauses.append("""
-            packageuploadsource.sourcepackagerelease =
-            sourcepackagerelease.id""")
-        source_where_clauses.append(
-            "sourcepackagerelease.sourcepackagename = sourcepackagename.id")
-
-        # modify build clause to lookup on binarypackagerelease
-        build_where_clauses.append(
-            "packageuploadbuild.build = binarypackagerelease.build")
-        build_where_clauses.append(
-            "binarypackagerelease.binarypackagename = binarypackagename.id")
-
-        # modify custom clause to lookup on libraryfilealias
-        custom_where_clauses.append(
-            "packageuploadcustom.libraryfilealias = "
-            "libraryfilealias.id")
-
-        # attempt to exact or similar names in builds, sources and custom
-        if exact_match:
-            source_where_clauses.append(
-                "sourcepackagename.name = '%s'" % name)
-            build_where_clauses.append("binarypackagename.name = '%s'" % name)
-            custom_where_clauses.append(
-                "libraryfilealias.filename='%s'" % name)
-        else:
-            source_where_clauses.append(
-                "sourcepackagename.name LIKE '%%' || %s || '%%'"
-                % quote_like(name))
-
-            build_where_clauses.append(
-                "binarypackagename.name LIKE '%%' || %s || '%%'"
-                % quote_like(name))
-
-            custom_where_clauses.append(
-                "libraryfilealias.filename LIKE '%%' || %s || '%%'"
-                % quote_like(name))
-
-        # attempt for given version argument, except by custom
-        if version:
-            # exact or similar matches
-            if exact_match:
-                source_where_clauses.append(
-                    "sourcepackagerelease.version = '%s'" % version)
-                build_where_clauses.append(
-                    "binarypackagerelease.version = '%s'" % version)
-            else:
-                source_where_clauses.append(
-                    "sourcepackagerelease.version LIKE '%%' || %s || '%%'"
-                    % quote_like(version))
-                build_where_clauses.append(
-                    "binarypackagerelease.version LIKE '%%' || %s || '%%'"
-                    % quote_like(version))
-
-        source_clauseTables = [
-            'PackageUploadSource',
-            'SourcePackageRelease',
-            'SourcePackageName',
-            ]
-        source_orderBy = ['-sourcepackagerelease.dateuploaded']
-
-        build_clauseTables = [
-            'PackageUploadBuild',
-            'BinaryPackageRelease',
-            'BinaryPackageName',
-            ]
-        build_orderBy = ['-binarypackagerelease.datecreated']
-
-        custom_clauseTables = [
-            'PackageUploadCustom',
-            'LibraryFileAlias',
-            ]
-        custom_orderBy = ['-LibraryFileAlias.id']
-
-        source_where_clause = " AND ".join(source_where_clauses)
-        source_results = PackageUpload.select(
-            source_where_clause, clauseTables=source_clauseTables,
-            orderBy=source_orderBy)
-
-        build_where_clause = " AND ".join(build_where_clauses)
-        build_results = PackageUpload.select(
-            build_where_clause, clauseTables=build_clauseTables,
-            orderBy=build_orderBy)
-
-        custom_where_clause = " AND ".join(custom_where_clauses)
-        custom_results = PackageUpload.select(
-            custom_where_clause, clauseTables=custom_clauseTables,
-            orderBy=custom_orderBy)
-
-        # XXX StuartBishop 2010-03-11 bug=537335
-        # This method is attempting to return ordered results but
-        # failing. It is also referencing non-existing documentation
-        # in the docstring - this method does not exist in the IDistroSeries
-        # interface.
-
-        return source_results.union(build_results.union(custom_results))
-
     def createBug(self, bug_params):
         """See canonical.launchpad.interfaces.IBugTarget."""
         # We don't currently support opening a new bug on an IDistroSeries,

=== modified file 'lib/lp/soyuz/browser/queue.py'
--- lib/lp/soyuz/browser/queue.py	2011-06-13 11:51:46 +0000
+++ lib/lp/soyuz/browser/queue.py	2011-06-16 13:33:24 +0000
@@ -68,7 +68,7 @@
         try:
             state_value = int(self.request.get('queue_state', ''))
         except ValueError:
-            state_value = 0
+            state_value = PackageUploadStatus.NEW.value
 
         try:
             self.state = PackageUploadStatus.items[state_value]
@@ -89,19 +89,14 @@
         self.filtered_options = []
 
         for state in valid_states:
-            if state == self.state:
-                selected = True
-            else:
-                selected = False
+            selected = (state == self.state)
             self.filtered_options.append(
-                dict(name=state.title, value=state.value, selected=selected)
-                )
+                dict(name=state.title, value=state.value, selected=selected))
 
-        # request context queue items according the selected state
-        queue_items = self.context.getQueueItems(
+        queue_items = self.context.getPackageUploads(
             status=self.state, name=self.name_filter)
-        self.batchnav = BatchNavigator(queue_items, self.request,
-                                       size=QUEUE_SIZE)
+        self.batchnav = BatchNavigator(
+            queue_items, self.request, size=QUEUE_SIZE)
 
     def builds_dict(self, upload_ids, binary_files):
         """Return a dictionary of PackageUploadBuild keyed on build ID.

=== modified file 'lib/lp/soyuz/browser/tests/test_queue.py'
--- lib/lp/soyuz/browser/tests/test_queue.py	2011-06-14 10:08:40 +0000
+++ lib/lp/soyuz/browser/tests/test_queue.py	2011-06-16 13:33:24 +0000
@@ -10,12 +10,10 @@
     getUtility,
     queryMultiAdapter,
     )
-from zope.security.proxy import removeSecurityProxy
 
 from canonical.launchpad.webapp.servers import LaunchpadTestRequest
 from canonical.testing.layers import LaunchpadFunctionalLayer
 from lp.archiveuploader.tests import datadir
-from lp.soyuz.adapters.overrides import SourceOverride
 from lp.soyuz.enums import PackageUploadStatus
 from lp.soyuz.interfaces.archivepermission import IArchivePermissionSet
 from lp.soyuz.interfaces.queue import IPackageUploadSet
@@ -26,6 +24,7 @@
     person_logged_in,
     TestCaseWithFactory,
     )
+from lp.testing.sampledata import ADMIN_EMAIL
 from lp.testing.views import create_initialized_view
 
 
@@ -197,38 +196,37 @@
 
     layer = LaunchpadFunctionalLayer
 
-    def makeView(self, distroseries, user, form):
+    def makeView(self, distroseries, user):
         """Create a queue view."""
         return create_initialized_view(
             distroseries, name='+queue', principal=user)
 
-    def makeCopyJobUpload(self, distroseries, component):
-        """Create a `PackageUpload` with a `PackageCopyJob`."""
-        job = self.factory.makePlainPackageCopyJob(
-            target_distroseries=distroseries)
-        job.addSourceOverride(SourceOverride(
-            self.factory.makeSourcePackageName().name,
-            component=component, section=self.factory.makeSection()))
-        naked_job = removeSecurityProxy(job).context
-        return self.factory.makePackageUpload(
-            distroseries=distroseries, package_copy_job=naked_job)
-
-    def test_copy_upload_does_not_break_rendering(self):
-        # The presence of a PackageUpload with a PackageCopyJob does not
-        # break rendering of the page.
-        # XXX JeroenVermeulen 2011-06-13 bug=394645: the current reason
-        # why this doesn't break is that the view uses getQueueItems,
-        # which won't return PackageUploads with copy jobs.  This test
-        # may start breaking once the view uses getPackageUploads.
-        distroseries = self.factory.makeDistroSeries()
-        component = self.factory.makeComponent()
-        upload = self.makeCopyJobUpload(distroseries, component=component)
-        queue_admin = self.factory.makeArchiveAdmin(distroseries.main_archive)
-        form = {
-            'queue_state': PackageUploadStatus.NEW.value,
-            'Accept': 'Accept',
-            'QUEUE_ID': [upload.id],
-            }
-        with person_logged_in(queue_admin):
-            view = self.makeView(distroseries, queue_admin, form)
-            view()
+    def test_view_renders_source_upload(self):
+        login(ADMIN_EMAIL)
+        upload = self.factory.makeSourcePackageUpload()
+        queue_admin = self.factory.makeArchiveAdmin(
+            upload.distroseries.main_archive)
+        with person_logged_in(queue_admin):
+            view = self.makeView(upload.distroseries, queue_admin)
+            html = view()
+        self.assertIn(upload.package_name, html)
+
+    def test_view_renders_build_upload(self):
+        login(ADMIN_EMAIL)
+        upload = self.factory.makeBuildPackageUpload()
+        queue_admin = self.factory.makeArchiveAdmin(
+            upload.distroseries.main_archive)
+        with person_logged_in(queue_admin):
+            view = self.makeView(upload.distroseries, queue_admin)
+            html = view()
+        self.assertIn(upload.package_name, html)
+
+    def test_view_renders_copy_upload(self):
+        login(ADMIN_EMAIL)
+        upload = self.factory.makeCopyJobPackageUpload()
+        queue_admin = self.factory.makeArchiveAdmin(
+            upload.distroseries.main_archive)
+        with person_logged_in(queue_admin):
+            view = self.makeView(upload.distroseries, queue_admin)
+            html = view()
+        self.assertIn(upload.package_name, html)

=== modified file 'lib/lp/soyuz/doc/distroseriesqueue-ddtp-tarball.txt'
--- lib/lp/soyuz/doc/distroseriesqueue-ddtp-tarball.txt	2011-06-15 09:49:37 +0000
+++ lib/lp/soyuz/doc/distroseriesqueue-ddtp-tarball.txt	2011-06-16 13:33:24 +0000
@@ -183,7 +183,7 @@
 previous upload:
 
     >>> from lp.soyuz.enums import PackageUploadStatus
-    >>> queue_item = breezy_autotest.getQueueItems(
+    >>> queue_item = breezy_autotest.getPackageUploads(
     ...      status=PackageUploadStatus.ACCEPTED)[0]
     >>> queue_item.customfiles[0].libraryfilealias.filename
     u'translations_main_20060728.tar.gz'
@@ -275,7 +275,7 @@
 
 Retrieve and publish new custom upload:
 
-    >>> queue_item = breezy_autotest.getQueueItems(
+    >>> queue_item = breezy_autotest.getPackageUploads(
     ...      status=PackageUploadStatus.ACCEPTED)[0]
 
     >>> pub_records = queue_item.realiseUpload()

=== modified file 'lib/lp/soyuz/doc/distroseriesqueue-dist-upgrader.txt'
--- lib/lp/soyuz/doc/distroseriesqueue-dist-upgrader.txt	2011-06-15 09:49:37 +0000
+++ lib/lp/soyuz/doc/distroseriesqueue-dist-upgrader.txt	2011-06-16 13:33:24 +0000
@@ -166,7 +166,7 @@
 previous upload:
 
     >>> from lp.soyuz.enums import PackageUploadStatus
-    >>> queue_item = breezy_autotest.getQueueItems(
+    >>> queue_item = breezy_autotest.getPackageUploads(
     ...      status=PackageUploadStatus.ACCEPTED)[0]
     >>> queue_item.customfiles[0].libraryfilealias.filename
     u'dist-upgrader_20060302.0120_all.tar.gz'

=== modified file 'lib/lp/soyuz/doc/distroseriesqueue-translations.txt'
--- lib/lp/soyuz/doc/distroseriesqueue-translations.txt	2011-06-15 09:49:37 +0000
+++ lib/lp/soyuz/doc/distroseriesqueue-translations.txt	2011-06-16 13:33:24 +0000
@@ -149,7 +149,7 @@
 An upload to the RELEASE pocket will add items to the import queue:
 
     >>> from lp.soyuz.enums import PackageUploadStatus
-    >>> queue_item = dapper.getQueueItems(
+    >>> queue_item = dapper.getPackageUploads(
     ...     status=PackageUploadStatus.NEW)[0]
     >>> queue_item.customfiles[0].publish()
 
@@ -183,7 +183,7 @@
 
     >>> ubuntu = getUtility(IDistributionSet)['ubuntu']
     >>> dapper = distro_series_set.queryByName(ubuntu, 'dapper')
-    >>> queue_item = dapper.getQueueItems(status=PackageUploadStatus.NEW)[0]
+    >>> queue_item = dapper.getPackageUploads(PackageUploadStatus.NEW)[0]
     >>> queue_item.pocket = PackagePublishingPocket.BACKPORTS
     >>> queue_item.customfiles[0].publish()
 
@@ -199,7 +199,7 @@
 
     >>> ubuntu = getUtility(IDistributionSet)['ubuntu']
     >>> dapper = distro_series_set.queryByName(ubuntu, 'dapper')
-    >>> queue_item = dapper.getQueueItems(status=PackageUploadStatus.NEW)[0]
+    >>> queue_item = dapper.getPackageUploads(PackageUploadStatus.NEW)[0]
     >>> queue_item.pocket = PackagePublishingPocket.UPDATES
     >>> queue_item.customfiles[0].publish()
 
@@ -229,7 +229,7 @@
     >>> ubuntu = getUtility(IDistributionSet)['ubuntu']
     >>> dapper = distro_series_set.queryByName(ubuntu, 'dapper')
     >>> restricted_component = getUtility(IComponentSet)['restricted']
-    >>> queue_item = dapper.getQueueItems(status=PackageUploadStatus.NEW)[0]
+    >>> queue_item = dapper.getPackageUploads(PackageUploadStatus.NEW)[0]
 
 # Change the component where this package was attached.
     >>> queue_item.builds[0].build.source_package_release.override(
@@ -262,7 +262,7 @@
     >>> ubuntu = getUtility(IDistributionSet)['ubuntu']
     >>> dapper = distro_series_set.queryByName(ubuntu, 'dapper')
     >>> universe_component = getUtility(IComponentSet)['universe']
-    >>> queue_item = dapper.getQueueItems(status=PackageUploadStatus.NEW)[0]
+    >>> queue_item = dapper.getPackageUploads(PackageUploadStatus.NEW)[0]
 
 # Change the component where this package was attached.
     >>> queue_item.builds[0].build.source_package_release.override(
@@ -294,7 +294,7 @@
     ...     owner=getUtility(IPersonSet).getByName('name16'))
 
     >>> dapper = getUtility(IDistributionSet)['ubuntu']['dapper']
-    >>> queue_item = dapper.getQueueItems(status=PackageUploadStatus.NEW)[0]
+    >>> queue_item = dapper.getPackageUploads(PackageUploadStatus.NEW)[0]
     >>> queue_item.archive = foobar_archive
 
     >>> queue_item.customfiles[0].publish(FakeLogger())
@@ -323,7 +323,7 @@
     ...     name='rebuilds')
 
     >>> dapper = getUtility(IDistributionSet)['ubuntu']['dapper']
-    >>> queue_item = dapper.getQueueItems(status=PackageUploadStatus.NEW)[0]
+    >>> queue_item = dapper.getPackageUploads(PackageUploadStatus.NEW)[0]
     >>> queue_item.archive = foobar_archive
 
     >>> queue_item.customfiles[0].publish(FakeLogger())

=== modified file 'lib/lp/soyuz/doc/distroseriesqueue.txt'
--- lib/lp/soyuz/doc/distroseriesqueue.txt	2011-06-15 09:49:37 +0000
+++ lib/lp/soyuz/doc/distroseriesqueue.txt	2011-06-16 13:33:24 +0000
@@ -84,7 +84,7 @@
     >>> from lp.soyuz.enums import PackageUploadStatus
     >>> from lp.soyuz.interfaces.queue import QueueInconsistentStateError
 
-    >>> new_queue = hoary.getQueueItems(PackageUploadStatus.NEW)
+    >>> new_queue = hoary.getPackageUploads(PackageUploadStatus.NEW)
 
 Use state-machine method provided by PackageUpload to ACCEPT an
 upload. If some designed check according the request state do not
@@ -100,7 +100,7 @@
     ...     except QueueInconsistentStateError, info:
     ...         print info
 
-    >>> accepted_queue = hoary.getQueueItems(PackageUploadStatus.ACCEPTED)
+    >>> accepted_queue = hoary.getPackageUploads(PackageUploadStatus.ACCEPTED)
 
     >>> from lp.services.log.logger import FakeLogger
     >>> for item in accepted_queue:
@@ -300,163 +300,12 @@
 IHasQueueItems
 --------------
 
-Explore the queue features of a DistroSeries instance, let's check
-some usages of IHasQueueItems.getQueueItems, which returns a list
-of IPackageUpload entries.
-
-    >>> new_items = breezy_autotest.getQueueItems(
-    ...    PackageUploadStatus.NEW)
-    >>> new_items.count()
-    6
-
-Invetigate the queue entries type:
-
-    >>> for n in new_items:
-    ...     n.builds.count(), n.sources.count()
-    (0, 0)
-    (0, 0)
-    (0, 1)
-    (0, 1)
-    (1, 0)
-    (1, 0)
-
-Exercises build side of getQueueItems, Retrieve queue entry for a
-name like 'moz':
-
-    >>> items = breezy_autotest.getQueueItems(PackageUploadStatus.NEW,
-    ...                                            name='moz')
-    >>> items.count()
-    1
-
-    >>> items[0].builds[0].build.binarypackages[0].name
-    u'mozilla-firefox'
-    >>> items[0].builds[0].build.binarypackages[0].version
-    u'0.9'
-
-Got a distroseries build queue entry for 'mozilla-firefox_0.9'
-
-Try with version:
-
-    >>> items = breezy_autotest.getQueueItems(PackageUploadStatus.NEW,
-    ...                                            name='moz', version='0.9')
-    >>> items.count()
-    1
-
-    >>> items[0].builds[0].build.binarypackages[0].name
-    u'mozilla-firefox'
-    >>> items[0].builds[0].build.binarypackages[0].version
-    u'0.9'
-
-Got the same queue entry.
-
-Let's try another entry where binary package name is LIKE 'pmount'
-
-    >>> items = breezy_autotest.getQueueItems(PackageUploadStatus.NEW,
-    ...                                            name='pmount')
-    >>> items.count()
-    1
-
-    >>> items[0].builds[0].build.binarypackages[0].name
-    u'pmount'
-    >>> items[0].builds[0].build.binarypackages[0].version
-    u'0.1-1'
-
-Got 'pmount_0.1-1'.
-
-Look for every queue entry which package name is like 'mo'
-
-    >>> items = breezy_autotest.getQueueItems(
-    ...     PackageUploadStatus.NEW, name='mo')
-    >>> items.count()
-    2
-
-XXX bug 537335, getQueueItems() fails to order properly so do it here
-to avoid spurious test failures:
-
-    >>> from operator import attrgetter
-    >>> for item in sorted(list(items), key=attrgetter('displayname')):
-    ...     a_binary = item.builds[0].build.binarypackages[0]
-    ...     print item.displayname
-    mozilla-firefox
-    pmount
-
-Got both sampledata results 'p_mo_unt' & '_mo_zilla-firefox'
-
-Try 'exact_match' for 'mozil_0.0.1'
-
-    >>> items = breezy_autotest.getQueueItems(PackageUploadStatus.NEW,
-    ...                 name='mozil', version='0.0.1', exact_match=True)
-    >>> items.count()
-    0
-
-There is no match on queue entries.
-
-Try to match custom uploads by filename, there is one sampledata
-custom upload in UNAPPROVED queue.
-
-    >>> items = breezy_autotest.getQueueItems(
-    ...      PackageUploadStatus.UNAPPROVED)
-    >>> items.count()
-    5
-
-We can't retrieve it with a 'what' substring:
-
-    >>> items = breezy_autotest.getQueueItems(
-    ...      PackageUploadStatus.UNAPPROVED, name='what')
-    >>> items.count()
-    0
-
-But it works with the right substring 'net' from 'netapplet.tar.gz'
-
-    >>> items = breezy_autotest.getQueueItems(
-    ...      PackageUploadStatus.UNAPPROVED, name='net')
-    >>> items.count()
-    2
-
-
-Also check the optional argument pocket:
-
-    >>> from lp.registry.interfaces.pocket import PackagePublishingPocket
-
-    >>> breezy_autotest.getQueueItems(
-    ...      pocket=PackagePublishingPocket.RELEASE).count()
-    10
-
-    >>> breezy_autotest.getQueueItems(
-    ...      pocket=PackagePublishingPocket.UPDATES).count()
-    1
-
-Ensure list of pockets is also valid:
-
-    >>> breezy_autotest.getQueueItems(
-    ...      pocket=[PackagePublishingPocket.UPDATES,
-    ...              PackagePublishingPocket.RELEASE]).count()
-    11
-
-
-Check if association of status and pocket arguments works well:
-
-    >>> breezy_autotest.getQueueItems(
-    ...      PackageUploadStatus.UNAPPROVED,
-    ...      pocket=PackagePublishingPocket.UPDATES).count()
-    1
-
-    >>> breezy_autotest.getQueueItems(
-    ...      PackageUploadStatus.NEW,
-    ...      pocket=PackagePublishingPocket.UPDATES).count()
-    0
-
-    >>> breezy_autotest.getQueueItems(
-    ...      [PackageUploadStatus.NEW, PackageUploadStatus.UNAPPROVED],
-    ...      pocket=PackagePublishingPocket.UPDATES).count()
-    1
-
 Check State Machine over PackageUploadBuilds:
 
 Performing full acceptance:
 
     >>> from canonical.launchpad.ftests import syncUpdate
-    >>> items = breezy_autotest.getQueueItems(PackageUploadStatus.NEW)
+    >>> items = breezy_autotest.getPackageUploads(PackageUploadStatus.NEW)
     >>> for item in items:
     ...      try:
     ...          item.setAccepted()
@@ -474,7 +323,8 @@
 
 Move the ACCEPTED items back to NEW.
 
-    >>> items = breezy_autotest.getQueueItems(PackageUploadStatus.ACCEPTED)
+    >>> items = breezy_autotest.getPackageUploads(
+    ...     PackageUploadStatus.ACCEPTED)
     >>> for item in items:
     ...     item.setNew()
     ...     print item.displayname, item.status.name
@@ -488,7 +338,7 @@
 
 Check if the state machine methods raise when trying to set the same state:
 
-    >>> items = breezy_autotest.getQueueItems(PackageUploadStatus.NEW)
+    >>> items = breezy_autotest.getPackageUploads(PackageUploadStatus.NEW)
     >>> for item in items:
     ...      try:
     ...          item.setNew()
@@ -521,8 +371,8 @@
 
 Retrieve mozilla-firefox Upload:
 
-    >>> item = breezy_autotest.getQueueItems(
-    ...     PackageUploadStatus.NEW, name='mozilla')[0]
+    >>> item = breezy_autotest.getPackageUploads(
+    ...     PackageUploadStatus.NEW, name=u'mozilla')[0]
 
 Override the mozilla-firefox component to fresh created 'hell' component.
 
@@ -542,8 +392,8 @@
 Check how we treat source upload duplications in UNAPPROVED queue (NEW
 has a similar behaviour):
 
-    >>> dups = breezy_autotest.getQueueItems(
-    ...     PackageUploadStatus.UNAPPROVED, name='cnews')
+    >>> dups = breezy_autotest.getPackageUploads(
+    ...     PackageUploadStatus.UNAPPROVED, name=u'cnews')
     >>> dups.count()
     2
     >>> dup_one, dup_two = list(dups)
@@ -616,8 +466,8 @@
 Retrieve the 'pmount' NEW queue entry and override it with a
 just-created, thus unofficial, section named 'boing'.
 
-    >>> item = breezy_autotest.getQueueItems(
-    ...     PackageUploadStatus.NEW, name='pmount')[0]
+    >>> item = breezy_autotest.getPackageUploads(
+    ...     PackageUploadStatus.NEW, name=u'pmount')[0]
 
     >>> pmount_binary = item.builds[0].build.binarypackages[0]
     >>> removeSecurityProxy(
@@ -691,30 +541,26 @@
     >>> from lp.testing.mail_helpers import pop_notifications
     >>> rubbish = pop_notifications()
 
-As mentioned above, values returned by 'getQueueItems' matching a given
+As mentioned above, values returned by getPackageUploads matching a given
 'name' and 'version' may contain different types of uploads.
 
 Sampledata contains only a i386 binary exactly matching 'pmount 0.1-1'.
 
+    >>> from operator import attrgetter
     >>> def print_queue_items(queue_items):
-    ...     # XXX StuartBishop 20100311 bug=537335
-    ...     # Sort items here as getQueueItems fails to do this.
-    ...     queue_items = sorted(list(queue_items),
-    ...         key=attrgetter(
-    ...             'displayarchs', 'displayname', 'displayversion'))
     ...     for queue_item in queue_items:
     ...         print "%s  %s  %s" % (
     ...             queue_item.displayname, queue_item.displayversion,
     ...             queue_item.displayarchs)
 
-    >>> queue_items = breezy_autotest.getQueueItems(
-    ...     PackageUploadStatus.NEW, name='pmount', version='0.1-1',
+    >>> queue_items = breezy_autotest.getPackageUploads(
+    ...     PackageUploadStatus.NEW, name=u'pmount', version=u'0.1-1',
     ...     exact_match=True)
     >>> print_queue_items(queue_items)
     pmount  0.1-1  i386
 
-We will setup a very peculiar environment to test this aspect of
-`getQueueItems`. First we will include another a non-matching source
+We will set up a very peculiar environment to test this aspect of
+`getPackageUploads`. First we will include another a non-matching source
 version of pmount (0.1-2) into the binary pmount upload we already
 have in the sampledata.
 
@@ -727,8 +573,8 @@
 'pmount 0.1-1' binary upload continues to be returned when we query
 the queue for 'pmount 0.1-1', via the existing binary path.
 
-    >>> queue_items = breezy_autotest.getQueueItems(
-    ...     PackageUploadStatus.NEW, name='pmount', version='0.1-1',
+    >>> queue_items = breezy_autotest.getPackageUploads(
+    ...     PackageUploadStatus.NEW, name=u'pmount', version=u'0.1-1',
     ...     exact_match=True)
     >>> print_queue_items(queue_items)
     pmount  0.1-1  i386
@@ -736,6 +582,7 @@
 Also, when we can create a source 'pmount 0.1-1' upload in the
 breezy-autotest context. It also becomes part of the lookup results.
 
+    >>> from lp.registry.interfaces.pocket import PackagePublishingPocket
     >>> candidate_queue = breezy_autotest.createQueueEntry(
     ...     PackagePublishingPocket.RELEASE,
     ...     breezy_autotest.main_archive,
@@ -744,12 +591,12 @@
     >>> unused = candidate_queue.addSource(
     ...     matching_pmount.sourcepackagerelease)
 
-    >>> queue_items = breezy_autotest.getQueueItems(
-    ...     PackageUploadStatus.NEW, name='pmount', version='0.1-1',
+    >>> queue_items = breezy_autotest.getPackageUploads(
+    ...     PackageUploadStatus.NEW, name=u'pmount', version=u'0.1-1',
     ...     exact_match=True)
     >>> print_queue_items(queue_items)
+    pmount  0.1-1  source
     pmount  0.1-1  i386
-    pmount  0.1-1  source
 
 It means that call sites querying the upload queue should be aware of
 this aspect and filter the results appropriately.
@@ -766,9 +613,9 @@
     >>> [binary_item, source_item] = queue_items
     >>> binary_item.setAccepted()
 
-    >>> queue_items = breezy_autotest.getQueueItems(
-    ...     PackageUploadStatus.ACCEPTED, name='pmount', version='0.1-1',
-    ...     exact_match=True)
+    >>> queue_items = breezy_autotest.getPackageUploads(
+    ...     PackageUploadStatus.ACCEPTED, name=u'pmount',
+    ...     version=u'0.1-1', exact_match=True)
     >>> print_queue_items(queue_items)
     pmount  0.1-1  i386
 
@@ -778,12 +625,12 @@
 
 Both uploads are waiting to be published.
 
-    >>> queue_items = breezy_autotest.getQueueItems(
-    ...     PackageUploadStatus.ACCEPTED, name='pmount', version='0.1-1',
-    ...     exact_match=True)
+    >>> queue_items = breezy_autotest.getPackageUploads(
+    ...     PackageUploadStatus.ACCEPTED, name=u'pmount',
+    ...     version='0.1-1', exact_match=True)
     >>> print_queue_items(queue_items)
+    pmount  0.1-1  source
     pmount  0.1-1  i386
-    pmount  0.1-1  source
 
 Let's publish them.
 
@@ -809,8 +656,8 @@
 The alsa-utils source is already in the queue with component "main"
 and section "base".
 
-    >>> [item] = breezy_autotest.getQueueItems(
-    ...     PackageUploadStatus.NEW, name='alsa-utils')
+    >>> [item] = breezy_autotest.getPackageUploads(
+    ...     PackageUploadStatus.NEW, name=u'alsa-utils')
     >>> [source] = item.sources
     >>> print "%s/%s" % (
     ...     source.sourcepackagerelease.component.name,
@@ -855,8 +702,8 @@
 
 Similarly for binaries:
 
-    >>> [item] = breezy_autotest.getQueueItems(
-    ...     PackageUploadStatus.NEW, name='pmount')
+    >>> [item] = breezy_autotest.getPackageUploads(
+    ...     PackageUploadStatus.NEW, name=u'pmount')
     >>> [build] = item.builds
     >>> [binary_package] = build.build.binarypackages
     >>> print "%s/%s/%s" % (

=== modified file 'lib/lp/soyuz/doc/soyuz-set-of-uploads.txt'
--- lib/lp/soyuz/doc/soyuz-set-of-uploads.txt	2011-06-15 09:49:37 +0000
+++ lib/lp/soyuz/doc/soyuz-set-of-uploads.txt	2011-06-16 13:33:24 +0000
@@ -164,7 +164,7 @@
     >>> def process_accepted(distro):
     ...     distribution = getUtility(IDistributionSet)[distro]
     ...     for series in distribution.series:
-    ...         items = series.getQueueItems(
+    ...         items = series.getPackageUploads(
     ...            status=PackageUploadStatus.ACCEPTED)
     ...         for item in items:
     ...             item.realiseUpload()
@@ -179,11 +179,12 @@
     ...     if series is None:
     ...         series = "breezy"
     ...     dr, pocket = distribution.getDistroSeriesAndPocket(series)
-    ...     items = dr.getQueueItems(status=PackageUploadStatus.NEW)
+    ...     items = dr.getPackageUploads(status=PackageUploadStatus.NEW)
     ...     for item in items:
     ...         item.setAccepted()
     ...         syncUpdate(item)
-    ...     items = dr.getQueueItems(status=PackageUploadStatus.UNAPPROVED)
+    ...     items = dr.getPackageUploads(
+    ...         status=PackageUploadStatus.UNAPPROVED)
     ...     for item in items:
     ...         item.setAccepted()
     ...         syncUpdate(item)

=== modified file 'lib/lp/soyuz/doc/soyuz-upload.txt'
--- lib/lp/soyuz/doc/soyuz-upload.txt	2011-06-15 09:49:37 +0000
+++ lib/lp/soyuz/doc/soyuz-upload.txt	2011-06-16 13:33:24 +0000
@@ -454,57 +454,9 @@
     >>> distro = getUtility(IDistributionSet).getByName('ubuntutest')
     >>> series = distro['breezy-autotest']
 
-Let's test IHasQueueItems.getQueueItems:
-
-    >>> new_items = series.getQueueItems(PackageUploadStatus.NEW)
-    >>> new_items.count()
-    2
-
-Querying by status and a name term:
-
-    >>> items = series.getQueueItems(PackageUploadStatus.NEW, name='dr')
-    >>> items.count()
-    1
-
-    >>> items[0].sources[0].sourcepackagerelease.name
-    u'drdsl'
-    >>> items[0].sources[0].sourcepackagerelease.version
-    u'1.2.0-0ubuntu1'
-
-Querying by status, name and version terms:
-
-    >>> items = series.getQueueItems(PackageUploadStatus.NEW,
-    ...                               name='dr', version='1.2')
-    >>> items.count()
-    1
-
-    >>> items = series.getQueueItems(PackageUploadStatus.NEW,
-    ...                               name='dr', version='1.5')
-    >>> items.count()
-    0
-
-Using exact_match argument:
-
-As you can see exact_match arguments affects both, name & version:
-
-# XXX cprov 2006-01-25 bug=29642:
-# Andrew suggest we can split the exact_match
-# attribute in two, as exact_name & exact_version, which might be
-# a good idea, since it produce a more controllable behaviour.
-
-    >>> items = series.getQueueItems(PackageUploadStatus.NEW,
-    ...                      name='dr', version='1.2', exact_match=True)
-    >>> items.count()
-    0
-
-    >>> items = series.getQueueItems(PackageUploadStatus.NEW,
-    ...          name='drdsl', version='1.2.0-0ubuntu1', exact_match=True)
-    >>> items.count()
-    1
-
-Using getQueueItem to inspect current NEW queue and accept them.
-
-    >>> queue_items = series.getQueueItems(PackageUploadStatus.NEW)
+We use getPackageUploads to inspect the current NEW queue and accept items.
+
+    >>> queue_items = series.getPackageUploads(status=PackageUploadStatus.NEW)
     >>> L = []
     >>> for queue_item in queue_items:
     ...      try:

=== modified file 'lib/lp/soyuz/interfaces/queue.py'
--- lib/lp/soyuz/interfaces/queue.py	2011-06-15 02:41:34 +0000
+++ lib/lp/soyuz/interfaces/queue.py	2011-06-16 13:33:24 +0000
@@ -616,7 +616,8 @@
 
         :param created_since_date: If specified, only returns items uploaded
             since the timestamp supplied.
-        :param status: Filter results by this `PackageUploadStatus`
+        :param status: Filter results by this `PackageUploadStatus`, or list
+            of `PackageUploadStatus`es.
         :param archive: Filter results for this `IArchive`
         :param pocket: Filter results by this `PackagePublishingPocket`
         :param custom_type: Filter results by this `PackageUploadCustomFormat`
@@ -659,28 +660,3 @@
 
     def getPackageUploadQueue(state):
         """Return an IPackageUploadeQueue occording the given state."""
-
-    def getQueueItems(status=None, name=None, version=None,
-                      exact_match=False, pocket=None, archive=None):
-        """Get the union of builds, sources and custom queue items.
-
-        Returns builds, sources and custom queue items in a given state,
-        matching a give name and version terms.
-
-        If 'status' is not supplied, return all items in the queues,
-        it supports multiple statuses as a list.
-
-        If 'name' and 'version' are supplied only items which match (SQL LIKE)
-        the sourcepackage name, binarypackage name or the filename will be
-        returned.  'name' can be supplied without supplying 'version'.
-        'version' has no effect on custom queue items.
-
-        If 'pocket' is specified return only queue items inside it, otherwise
-        return all pockets.  It supports multiple pockets as a list.
-
-        If 'archive' is specified return only queue items targeted to this
-        archive, if not restrict the results to the
-        IDistribution.main_archive.
-
-        Use 'exact_match' argument for precise results.
-        """

=== modified file 'lib/lp/soyuz/model/packagecopyjob.py'
--- lib/lp/soyuz/model/packagecopyjob.py	2011-06-16 12:40:57 +0000
+++ lib/lp/soyuz/model/packagecopyjob.py	2011-06-16 13:33:24 +0000
@@ -17,7 +17,6 @@
     Unicode,
     )
 import transaction
-
 from zope.component import getUtility
 from zope.interface import (
     classProvides,
@@ -38,12 +37,12 @@
 from lp.registry.interfaces.distroseriesdifference import (
     IDistroSeriesDifferenceSource,
     )
+from lp.registry.interfaces.distroseriesdifferencecomment import (
+    IDistroSeriesDifferenceCommentSource,
+    )
 from lp.registry.interfaces.pocket import PackagePublishingPocket
 from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
 from lp.registry.model.distroseries import DistroSeries
-from lp.registry.interfaces.distroseriesdifferencecomment import (
-    IDistroSeriesDifferenceCommentSource,
-    )
 from lp.services.database.stormbase import StormBase
 from lp.services.job.interfaces.job import (
     JobStatus,

=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py	2011-06-15 02:41:34 +0000
+++ lib/lp/soyuz/model/queue.py	2011-06-16 13:33:24 +0000
@@ -1391,16 +1391,6 @@
                archive=None, pocket=None, custom_type=None, name=None,
                version=None, exact_match=False):
         """See `IPackageUploadSet`."""
-        # XXX Julian 2009-07-02 bug=394645
-        # This method is an incremental deprecation of
-        # IDistroSeries.getQueueItems(). It's basically re-writing it
-        # using Storm queries instead of SQLObject, but not everything
-        # is implemented yet.  When it is, this comment and the old
-        # method can be removed and call sites updated to use this one.
-
-        # XXX 2011-06-11 JeroenVermeulen bug=795651: The "archive"
-        # argument is currently ignored.  Not sure why.
-
         # Avoid circular imports.
         from lp.soyuz.model.packagecopyjob import PackageCopyJob
         from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease

=== modified file 'lib/lp/soyuz/scripts/initialize_distroseries.py'
--- lib/lp/soyuz/scripts/initialize_distroseries.py	2011-06-14 19:49:18 +0000
+++ lib/lp/soyuz/scripts/initialize_distroseries.py	2011-06-16 13:33:24 +0000
@@ -124,14 +124,16 @@
         """
         # only the RELEASE pocket is inherited, so we only check
         # queue items for it.
-        for queue in (
-            PackageUploadStatus.NEW, PackageUploadStatus.ACCEPTED,
-            PackageUploadStatus.UNAPPROVED):
-            items = self.parent.getQueueItems(
-                queue, pocket=PackagePublishingPocket.RELEASE)
-            if items:
-                raise InitializationError(
-                    "Parent series queues are not empty.")
+        statuses = [
+            PackageUploadStatus.NEW,
+            PackageUploadStatus.ACCEPTED,
+            PackageUploadStatus.UNAPPROVED,
+            ]
+        items = self.parent.getPackageUploads(
+            status=statuses, pocket=PackagePublishingPocket.RELEASE)
+        if not items.is_empty():
+            raise InitializationError(
+                "Parent series queues are not empty.")
 
     def _checkSeries(self):
         error = (

=== modified file 'lib/lp/soyuz/scripts/processaccepted.py'
--- lib/lp/soyuz/scripts/processaccepted.py	2011-06-15 09:49:37 +0000
+++ lib/lp/soyuz/scripts/processaccepted.py	2011-06-16 13:33:24 +0000
@@ -265,8 +265,8 @@
                     self.logger.debug("Processing queue for %s %s" % (
                         distroseries.name, description))
 
-                    queue_items = distroseries.getQueueItems(
-                        PackageUploadStatus.ACCEPTED, archive=archive)
+                    queue_items = distroseries.getPackageUploads(
+                        status=PackageUploadStatus.ACCEPTED, archive=archive)
                     for queue_item in queue_items:
                         self.logger.debug(
                             "Processing queue item %d" % queue_item.id)

=== modified file 'lib/lp/soyuz/scripts/queue.py'
--- lib/lp/soyuz/scripts/queue.py	2011-06-15 02:41:34 +0000
+++ lib/lp/soyuz/scripts/queue.py	2011-06-16 13:33:24 +0000
@@ -194,12 +194,10 @@
                     term, version = term.strip().split('/')
 
                 # Expand SQLObject results.
-                # XXX 2011-06-13 JeroenVermeulen bug=394645: This should
-                # use getPackageUploads, not getQueueItems, so that it
-                # will also include copy-job uploads.
-                for item in self.distroseries.getQueueItems(
+                queue_items = self.distroseries.getPackageUploads(
                     status=self.queue, name=term, version=version,
-                    exact_match=self.exact_match, pocket=self.pocket):
+                    exact_match=self.exact_match, pocket=self.pocket)
+                for item in queue_items:
                     if item not in self.items:
                         self.items.append(item)
                 self.package_names.append(term)
@@ -683,7 +681,7 @@
         # check syntax, abort process if anything gets wrong
         try:
             action = terms[0]
-            arguments = terms[1:]
+            arguments = [unicode(term) for term in terms[1:]]
         except IndexError:
             raise CommandRunnerError('Invalid sentence, use help.')
 

=== modified file 'lib/lp/soyuz/scripts/tests/test_queue.py'
--- lib/lp/soyuz/scripts/tests/test_queue.py	2011-06-15 02:41:34 +0000
+++ lib/lp/soyuz/scripts/tests/test_queue.py	2011-06-16 13:33:24 +0000
@@ -419,12 +419,12 @@
         self.assertEqual(3, queue_action.items_size)
 
         self.assertQueueLength(1, breezy_autotest,
-            PackageUploadStatus.ACCEPTED, 'mozilla-firefox')
+            PackageUploadStatus.ACCEPTED, u'mozilla-firefox')
         self.assertQueueLength(1, breezy_autotest,
-            PackageUploadStatus.ACCEPTED, 'pmount')
+            PackageUploadStatus.ACCEPTED, u'pmount')
         # Single-source upload went straight to DONE queue.
         self.assertQueueLength(1, breezy_autotest,
-            PackageUploadStatus.DONE, 'netapplet')
+            PackageUploadStatus.DONE, u'netapplet')
 
     def testRemovedPublishRecordDoesNotAffectQueueNewness(self):
         """Check if REMOVED published record does not affect file NEWness.
@@ -506,7 +506,7 @@
 
         # Store the targeted queue item for future inspection.
         # Ensure it is what we expect.
-        target_queue = breezy_autotest.getQueueItems(
+        target_queue = breezy_autotest.getPackageUploads(
             status=PackageUploadStatus.UNAPPROVED,
             pocket=PackagePublishingPocket.BACKPORTS)[0]
         self.assertEqual(10, target_queue.id)
@@ -554,7 +554,7 @@
 
         # Store the targeted queue item for future inspection.
         # Ensure it is what we expect.
-        target_queue = breezy_autotest.getQueueItems(
+        target_queue = breezy_autotest.getPackageUploads(
             status=PackageUploadStatus.UNAPPROVED,
             pocket=PackagePublishingPocket.PROPOSED)[0]
         self.assertEqual(12, target_queue.id)
@@ -576,7 +576,8 @@
         self.assertEqual(0, len(stub.test_emails))
 
     def assertQueueLength(self, expected_length, distro_series, status, name):
-        queue_items = distro_series.getQueueItems(status=status, name=name)
+        queue_items = distro_series.getPackageUploads(
+            status=status, name=name)
         self.assertEqual(expected_length, queue_items.count())
 
     def assertErrorAcceptingDuplicate(self):
@@ -622,7 +623,7 @@
 
         # Certify we have a 'cnews' upload duplication in UNAPPROVED.
         self.assertQueueLength(
-            2, breezy_autotest, PackageUploadStatus.UNAPPROVED, "cnews")
+            2, breezy_autotest, PackageUploadStatus.UNAPPROVED, u"cnews")
 
         # Step 1: try to accept both.
         self.execute_command(
@@ -632,12 +633,12 @@
         # The first item, being a single source upload, is automatically
         # published when it's accepted.
         self.assertQueueLength(
-            1, breezy_autotest, PackageUploadStatus.DONE, "cnews")
+            1, breezy_autotest, PackageUploadStatus.DONE, u"cnews")
 
         # The last can't be accepted and remains in UNAPPROVED.
         self.assertErrorAcceptingDuplicate()
         self.assertQueueLength(
-            1, breezy_autotest, PackageUploadStatus.UNAPPROVED, "cnews")
+            1, breezy_autotest, PackageUploadStatus.UNAPPROVED, u"cnews")
 
         # Step 2: try to accept the remaining item in UNAPPROVED.
         self.execute_command(
@@ -645,7 +646,7 @@
             suite_name='breezy-autotest')
         self.assertErrorAcceptingDuplicate()
         self.assertQueueLength(
-            1, breezy_autotest, PackageUploadStatus.UNAPPROVED, "cnews")
+            1, breezy_autotest, PackageUploadStatus.UNAPPROVED, u"cnews")
 
         # Step 3: try to accept the remaining item in UNAPPROVED with the
         # duplication already in DONE.
@@ -655,16 +656,16 @@
         # It failed and te item remains in UNAPPROVED.
         self.assertErrorAcceptingDuplicate()
         self.assertQueueLength(
-            1, breezy_autotest, PackageUploadStatus.UNAPPROVED, "cnews")
+            1, breezy_autotest, PackageUploadStatus.UNAPPROVED, u"cnews")
 
         # Step 4: The only possible destiny for the remaining item it REJECT.
         self.execute_command(
             'reject cnews', queue_name='unapproved',
             suite_name='breezy-autotest')
         self.assertQueueLength(
-            0, breezy_autotest, PackageUploadStatus.UNAPPROVED, "cnews")
+            0, breezy_autotest, PackageUploadStatus.UNAPPROVED, u"cnews")
         self.assertQueueLength(
-            1, breezy_autotest, PackageUploadStatus.REJECTED, "cnews")
+            1, breezy_autotest, PackageUploadStatus.REJECTED, u"cnews")
 
     def testRejectSourceSendsEmail(self):
         """Check that rejecting a source upload sends email."""
@@ -707,11 +708,11 @@
         # NEW queue originally, the items processed should now be REJECTED.
         self.assertEqual(3, queue_action.items_size)
         self.assertQueueLength(1, breezy_autotest,
-            PackageUploadStatus.REJECTED, 'mozilla-firefox')
-        self.assertQueueLength(1, breezy_autotest,
-            PackageUploadStatus.REJECTED, 'pmount')
-        self.assertQueueLength(1, breezy_autotest,
-            PackageUploadStatus.REJECTED, 'netapplet')
+            PackageUploadStatus.REJECTED, u'mozilla-firefox')
+        self.assertQueueLength(1, breezy_autotest,
+            PackageUploadStatus.REJECTED, u'pmount')
+        self.assertQueueLength(1, breezy_autotest,
+            PackageUploadStatus.REJECTED, u'netapplet')
 
     def testOverrideSource(self):
         """Check if overriding sources works.
@@ -728,8 +729,8 @@
         queue_action = self.execute_command('override source 4',
             component_name='restricted', section_name='web')
         self.assertEqual(1, queue_action.items_size)
-        queue_item = breezy_autotest.getQueueItems(
-            status=PackageUploadStatus.NEW, name="alsa-utils")[0]
+        queue_item = breezy_autotest.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u"alsa-utils")[0]
         [source] = queue_item.sources
         self.assertEqual('restricted',
             source.sourcepackagerelease.component.name)
@@ -743,10 +744,10 @@
         self.assertEqual(4, queue_action.items_size)
         self.assertEqual(2, queue_action.overrides_performed)
         # Check results.
-        queue_items = list(breezy_autotest.getQueueItems(
-            status=PackageUploadStatus.NEW, name='alsa-utils'))
-        queue_items.extend(list(breezy_autotest.getQueueItems(
-            status=PackageUploadStatus.NEW, name='netapplet')))
+        queue_items = list(breezy_autotest.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u'alsa-utils'))
+        queue_items.extend(list(breezy_autotest.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u'netapplet')))
         for queue_item in queue_items:
             if queue_item.sources:
                 [source] = queue_item.sources
@@ -769,8 +770,8 @@
         queue_action = self.execute_command('override source alsa-utils',
             component_name='partner')
         self.assertEqual(1, queue_action.items_size)
-        [queue_item] = breezy_autotest.getQueueItems(
-            status=PackageUploadStatus.NEW, name="alsa-utils")
+        [queue_item] = breezy_autotest.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u"alsa-utils")
         [source] = queue_item.sources
         self.assertEqual(source.sourcepackagerelease.upload_archive.purpose,
             ArchivePurpose.PARTNER)
@@ -779,8 +780,8 @@
         queue_action = self.execute_command('override source alsa-utils',
             component_name='main')
         self.assertEqual(1, queue_action.items_size)
-        [queue_item] = breezy_autotest.getQueueItems(
-            status=PackageUploadStatus.NEW, name="alsa-utils")
+        [queue_item] = breezy_autotest.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u"alsa-utils")
         [source] = queue_item.sources
         self.assertEqual(source.sourcepackagerelease.upload_archive.purpose,
             ArchivePurpose.PRIMARY)
@@ -822,8 +823,8 @@
             component_name='restricted', section_name='web',
             priority_name='extra')
         self.assertEqual(1, queue_action.items_size)
-        [queue_item] = breezy_autotest.getQueueItems(
-            status=PackageUploadStatus.NEW, name="pmount")
+        [queue_item] = breezy_autotest.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u"pmount")
         [packagebuild] = queue_item.builds
         for package in packagebuild.build.binarypackages:
             self.assertEqual('restricted', package.component.name)
@@ -838,10 +839,10 @@
         # Check results.
         self.assertEqual(2, queue_action.items_size)
         self.assertEqual(2, queue_action.overrides_performed)
-        queue_items = list(breezy_autotest.getQueueItems(
-            status=PackageUploadStatus.NEW, name='pmount'))
-        queue_items.extend(list(breezy_autotest.getQueueItems(
-            status=PackageUploadStatus.NEW, name='mozilla-firefox')))
+        queue_items = list(breezy_autotest.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u'pmount'))
+        queue_items.extend(list(breezy_autotest.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u'mozilla-firefox')))
         for queue_item in queue_items:
             [packagebuild] = queue_item.builds
             for package in packagebuild.build.binarypackages:
@@ -866,8 +867,8 @@
 
         breezy_autotest = getUtility(
             IDistributionSet)['ubuntu']['breezy-autotest']
-        [mozilla_queue_item] = breezy_autotest.getQueueItems(
-            status=PackageUploadStatus.NEW, name='mozilla-firefox')
+        [mozilla_queue_item] = breezy_autotest.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u'mozilla-firefox')
 
         # The build with ID '2' is for mozilla-firefox, which produces
         # binaries for 'mozilla-firefox' and 'mozilla-firefox-data'.
@@ -892,10 +893,10 @@
         self.assertEqual(1, queue_action.items_size)
         self.assertEqual(3, queue_action.overrides_performed)
 
-        queue_items = list(breezy_autotest.getQueueItems(
-            status=PackageUploadStatus.NEW, name='mozilla-firefox-data'))
-        queue_items.extend(list(breezy_autotest.getQueueItems(
-            status=PackageUploadStatus.NEW, name='mozilla-firefox')))
+        queue_items = list(breezy_autotest.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u'mozilla-firefox-data'))
+        queue_items.extend(list(breezy_autotest.getPackageUploads(
+            status=PackageUploadStatus.NEW, name=u'mozilla-firefox')))
         for queue_item in queue_items:
             for packagebuild in queue_item.builds:
                 for package in packagebuild.build.binarypackages:

=== modified file 'lib/lp/soyuz/templates/distroseries-queue.pt'
--- lib/lp/soyuz/templates/distroseries-queue.pt	2010-12-20 04:43:45 +0000
+++ lib/lp/soyuz/templates/distroseries-queue.pt	2011-06-16 13:33:24 +0000
@@ -298,15 +298,17 @@
     :libraryfilealias: A LibraryFileAlias to link to. If it is expired,
       no link will be created.
   </tal:comment>
-  <tal:unexpired tal:condition="libraryfilealias/content">
-    <a tal:attributes="href libraryfilealias/http_url">
-      <tal:filename replace="libraryfilealias/filename"/>
-    </a>
-    (<span tal:replace="libraryfilealias/content/filesize/fmt:bytes" />)
-  </tal:unexpired>
-  <tal:expired tal:condition="not:libraryfilealias/content">
-    <span tal:content="libraryfilealias/filename"/>
-  </tal:expired>
+  <tal:not-none condition="libraryfilealias">
+    <tal:unexpired tal:condition="libraryfilealias/content">
+      <a tal:attributes="href libraryfilealias/http_url">
+        <tal:filename replace="libraryfilealias/filename"/>
+      </a>
+      (<span tal:replace="libraryfilealias/content/filesize/fmt:bytes" />)
+    </tal:unexpired>
+    <tal:expired tal:condition="not:libraryfilealias/content">
+      <span tal:content="libraryfilealias/filename"/>
+    </tal:expired>
+  </tal:not-none>
 </metal:macro>
 
 <metal:macro define-macro="package-iconlist">
@@ -333,12 +335,17 @@
          alt="[Debian Description Translation Project Indexes]"
          src="/@@/ubuntu-icon"
          title="Debian Description Translation Project Indexes"/>
-    <a tal:condition="not: packageupload/pending_delayed_copy"
-       tal:content="packageupload/displayname"
-       tal:attributes="
-         href packageupload/changesfile/http_url;
-         title string:Changes file for ${packageupload/displayname};">
-    </a>
+    <tal:not-delayed condition="not: packageupload/pending_delayed_copy">
+      <a tal:condition="packageupload/changesfile"
+         tal:content="packageupload/displayname"
+         tal:attributes="
+           href packageupload/changesfile/http_url;
+           title string:Changes file for ${packageupload/displayname};">
+      </a>
+      <tal:no-changes-file
+        condition="not: packageupload/changesfile"
+        replace="packageupload/displayname"/>
+    </tal:not-delayed>
     <tal:pending_delayed_copy_title
       condition="packageupload/pending_delayed_copy"
       replace="packageupload/displayname" />

=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
--- lib/lp/soyuz/tests/test_packageupload.py	2011-06-15 02:41:34 +0000
+++ lib/lp/soyuz/tests/test_packageupload.py	2011-06-16 13:33:24 +0000
@@ -688,13 +688,13 @@
             upload_set.getAll(
                 distroseries, name=partial_name, exact_match=True))
 
-    def test_getAll_without_exact_match_escapes_name_filter(self):
+    def test_getAll_without_exact_match_escapes_name(self):
         distroseries = self.factory.makeDistroSeries()
         upload_set = getUtility(IPackageUploadSet)
         self.assertContentEqual(
             [], upload_set.getAll(distroseries, name=u"'"))
 
-    def test_getAll_with_exact_match_escapes_name_filter(self):
+    def test_getAll_with_exact_match_escapes_name(self):
         distroseries = self.factory.makeDistroSeries()
         upload_set = getUtility(IPackageUploadSet)
         self.assertContentEqual(
@@ -778,7 +778,7 @@
             upload_set.getAll(
                 distroseries, version=version, exact_match=True))
 
-    def test_getAll_can_combine_version_and_name_filters(self):
+    def test_getAll_can_combine_version_and_name(self):
         distroseries = self.factory.makeDistroSeries()
         spn = self.factory.makeSourcePackageName()
         upload = self.factory.makeSourcePackageUpload(