← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/dsp-vocab-issues into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/dsp-vocab-issues into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/dsp-vocab-issues/+merge/68763

Correct some more found issues with the DSP vocab.

First, we should split on / for the distribution, source package name split, due to package names being able to include -.
Second, the search function needs to return an iterator, not a list!
-- 
https://code.launchpad.net/~stevenk/launchpad/dsp-vocab-issues/+merge/68763
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/dsp-vocab-issues into lp:launchpad.
=== modified file 'lib/lp/registry/tests/test_dsp_vocabularies.py'
--- lib/lp/registry/tests/test_dsp_vocabularies.py	2011-07-15 09:30:23 +0000
+++ lib/lp/registry/tests/test_dsp_vocabularies.py	2011-07-22 01:09:30 +0000
@@ -29,7 +29,7 @@
         vocabulary = DistributionSourcePackageVocabulary(dsp.distribution)
         term = vocabulary.toTerm(dsp.name)
         self.assertEqual(dsp.sourcepackagename.name, term.title)
-        expected_token = '%s-%s' % (dsp.distribution.name, dsp.name)
+        expected_token = '%s/%s' % (dsp.distribution.name, dsp.name)
         self.assertEqual(expected_token, term.token)
         self.assertEqual('Not yet built.', term.value)
 
@@ -42,7 +42,7 @@
             distribution=bpph.distroseries.distribution)
         vocabulary = DistributionSourcePackageVocabulary(dsp.distribution)
         term = vocabulary.toTerm(spr.sourcepackagename)
-        expected_token = '%s-%s' % (dsp.distribution.name, dsp.name)
+        expected_token = '%s/%s' % (dsp.distribution.name, dsp.name)
         self.assertEqual(expected_token, term.token)
         self.assertEqual(bpph.binary_package_name, term.value)
 
@@ -63,7 +63,7 @@
         dsp = spr.distrosourcepackage
         vocabulary = DistributionSourcePackageVocabulary(dsp.distribution)
         term = vocabulary.toTerm(spr.sourcepackagename)
-        expected_token = '%s-%s' % (dsp.distribution.name, dsp.name)
+        expected_token = '%s/%s' % (dsp.distribution.name, dsp.name)
         self.assertEqual(expected_token, term.token)
         self.assertEqual(', '.join(expected_names), term.value)
 

=== modified file 'lib/lp/registry/vocabularies.py'
--- lib/lp/registry/vocabularies.py	2011-07-15 09:30:23 +0000
+++ lib/lp/registry/vocabularies.py	2011-07-22 01:09:30 +0000
@@ -2004,7 +2004,7 @@
                 [binary.binary_package_name for binary in binaries])
         else:
             summary = "Not yet built."
-        token = '%s-%s' % (dsp.distribution.name, dsp.name)
+        token = '%s/%s' % (dsp.distribution.name, dsp.name)
         return SimpleTerm(summary, token, dsp.name)
 
     def getTerm(self, spn):
@@ -2059,4 +2059,4 @@
                     SourcePackageName.name.contains_string(search_term),
                     BinaryPackageName.name.contains_string(
                         search_term))).config(distinct=True)
-        return [self.toTerm(spn) for spn in spns]
+        return CountableIterator(spns.count(), spns, self.toTerm)