← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~stevenk/launchpad/spec-names-are-not-unique-vocab into lp:launchpad

 

Steve Kowalik has proposed merging lp:~stevenk/launchpad/spec-names-are-not-unique-vocab into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #408585 in Launchpad itself: "choosing blueprint for branch is broken"
  https://bugs.launchpad.net/launchpad/+bug/408585

For more details, see:
https://code.launchpad.net/~stevenk/launchpad/spec-names-are-not-unique-vocab/+merge/190849

Switch SpecificationVocabulary to using SQLObjectVocabularyBase. This is a bit of a subtle fix, since NamedSQLObjectVocabulary backs onto obj.name, and names of specifications are not unique; SQLObjectVocabularyBase uses obj.id. There are no tests for the vocabulary that I can find.
-- 
https://code.launchpad.net/~stevenk/launchpad/spec-names-are-not-unique-vocab/+merge/190849
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/spec-names-are-not-unique-vocab into lp:launchpad.
=== modified file 'lib/lp/blueprints/vocabularies/specification.py'
--- lib/lp/blueprints/vocabularies/specification.py	2012-12-01 22:59:58 +0000
+++ lib/lp/blueprints/vocabularies/specification.py	2013-10-14 02:03:23 +0000
@@ -15,10 +15,10 @@
 
 from lp.blueprints.model.specification import Specification
 from lp.services.webapp.interfaces import ILaunchBag
-from lp.services.webapp.vocabulary import NamedSQLObjectVocabulary
-
-
-class SpecificationVocabulary(NamedSQLObjectVocabulary):
+from lp.services.webapp.vocabulary import SQLObjectVocabularyBase
+
+
+class SpecificationVocabulary(SQLObjectVocabularyBase):
     """List specifications for the current product or distribution in
     ILaunchBag, EXCEPT for the current spec in LaunchBag if one exists.
     """
@@ -53,4 +53,4 @@
                     user = getattr(launchbag, 'user', None)
                     if spec in launchbag.specification.all_blocked(user=user):
                         continue
-                yield SimpleTerm(spec, spec.name, spec.title)
+                yield SimpleTerm(spec, spec.id, spec.title)


Follow ups