~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/vocabularies.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-07-08 19:26:35 UTC
  • mfrom: (13314.12.13 yui-test-cleanup-807294)
  • Revision ID: launchpad@pqm.canonical.com-20110708192635-acgqrciig42izbsh
[r=jtv][bug=807294] Consolidate duplicate code copied throughout the
        lp yui tests into a common module.

Show diffs side-by-side

added added

removed removed

Lines of Context:
168
168
from lp.registry.interfaces.projectgroup import IProjectGroup
169
169
from lp.registry.interfaces.sourcepackage import ISourcePackage
170
170
from lp.registry.model.distribution import Distribution
171
 
from lp.registry.model.distributionsourcepackage import (
172
 
    DistributionSourcePackage,
173
 
    )
174
171
from lp.registry.model.distroseries import DistroSeries
175
172
from lp.registry.model.distroseriesparent import DistroSeriesParent
176
173
from lp.registry.model.featuredproject import FeaturedProject
200
197
from lp.soyuz.model.binarypackagerelease import BinaryPackageRelease
201
198
from lp.soyuz.model.distroarchseries import DistroArchSeries
202
199
from lp.soyuz.model.publishing import (
203
 
    BinaryPackagePublishingHistory,
204
200
    SourcePackagePublishingHistory,
205
201
    )
206
202
from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
1265
1261
        return super_class.getTermByToken(token)
1266
1262
 
1267
1263
 
 
1264
class UserTeamsParticipationPlusSelfSimpleDisplayVocabulary(
 
1265
    UserTeamsParticipationPlusSelfVocabulary):
 
1266
    """Like UserTeamsParticipationPlusSelfVocabulary but the term title is
 
1267
    the person.displayname rather than unique_displayname.
 
1268
 
 
1269
    This vocab is used for pickers which append the Launchpad id to the
 
1270
    displayname. If we use the original UserTeamsParticipationPlusSelf vocab,
 
1271
    the Launchpad id is displayed twice.
 
1272
    """
 
1273
 
 
1274
    def toTerm(self, obj):
 
1275
        """See `IVocabulary`."""
 
1276
        return SimpleTerm(obj, obj.name, obj.displayname)
 
1277
 
 
1278
 
1268
1279
class ProductReleaseVocabulary(SQLObjectVocabularyBase):
1269
1280
    """All `IProductRelease` objects vocabulary."""
1270
1281
    implements(IHugeVocabulary)
1962
1973
        # package names are always lowercase.
1963
1974
        return super(SourcePackageNameVocabulary, self).getTermByToken(
1964
1975
            token.lower())
1965
 
 
 
1976
 
1966
1977
 
1967
1978
class DistributionSourcePackageVocabulary:
1968
1979