launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #15625
[Merge] lp:~wgrant/launchpad/bug-1087225 into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/bug-1087225 into lp:launchpad.
Commit message:
Adjust SpecificationDependenciesVocabulary to use IDs rather than names as the unique key, since spec names are only unique within a pillar.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1087223 in Launchpad itself: "blueprint 'remove dependency' UI doesn't distinguish multiple dependencies with same title"
https://bugs.launchpad.net/launchpad/+bug/1087223
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/bug-1087225/+merge/165543
Adjust SpecificationDependenciesVocabulary to use IDs rather than names as the unique key, since spec names are only unique within a pillar.
--
https://code.launchpad.net/~wgrant/launchpad/bug-1087225/+merge/165543
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/bug-1087225 into lp:launchpad.
=== modified file 'lib/lp/blueprints/stories/blueprints/xx-dependencies.txt'
--- lib/lp/blueprints/stories/blueprints/xx-dependencies.txt 2012-12-10 13:43:47 +0000
+++ lib/lp/blueprints/stories/blueprints/xx-dependencies.txt 2013-05-24 07:33:29 +0000
@@ -97,7 +97,7 @@
expect to be redirected to the blueprint page.
>>> owner_browser.getControl(
- ... 'Dependency').value = ['extension-manager-upgrades']
+ ... 'Dependency').value = ['1']
>>> owner_browser.getControl('Continue').click()
>>> owner_browser.url
'http://blueprints.launchpad.dev/firefox/+spec/canvas'
=== modified file 'lib/lp/blueprints/vocabularies/specificationdependency.py'
--- lib/lp/blueprints/vocabularies/specificationdependency.py 2013-01-25 03:30:08 +0000
+++ lib/lp/blueprints/vocabularies/specificationdependency.py 2013-05-24 07:33:29 +0000
@@ -9,9 +9,8 @@
'SpecificationDependenciesVocabulary',
]
-from operator import attrgetter
-
from storm.locals import (
+ And,
SQL,
Store,
)
@@ -23,6 +22,12 @@
recursive_blocked_query,
Specification,
)
+from lp.blueprints.model.specificationdependency import (
+ SpecificationDependency,
+ )
+from lp.blueprints.model.specificationsearch import (
+ get_specification_privacy_filter,
+ )
from lp.registry.interfaces.pillar import IPillarNameSet
from lp.services.database.stormexpr import fti_search
from lp.services.webapp import (
@@ -33,7 +38,6 @@
from lp.services.webapp.vocabulary import (
CountableIterator,
IHugeVocabulary,
- NamedSQLObjectVocabulary,
SQLObjectVocabularyBase,
)
@@ -196,14 +200,16 @@
return self._is_valid_candidate(obj)
-class SpecificationDependenciesVocabulary(NamedSQLObjectVocabulary):
+class SpecificationDependenciesVocabulary(SQLObjectVocabularyBase):
"""List specifications on which the current specification depends."""
_table = Specification
_orderBy = 'title'
- def __iter__(self):
+ @property
+ def _filter(self):
user = getattr(getUtility(ILaunchBag), 'user', None)
- for spec in sorted(
- self.context.getDependencies(user), key=attrgetter('title')):
- yield SimpleTerm(spec, spec.name, spec.title)
+ return And(
+ SpecificationDependency.specificationID == self.context.id,
+ SpecificationDependency.dependencyID == Specification.id,
+ *get_specification_privacy_filter(user))