~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/model/product.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-10-11 09:06:29 UTC
  • mfrom: (14120.2.8 bug-869089)
  • Revision ID: launchpad@pqm.canonical.com-20111011090629-2t5okp0ri4ow6yr0
[r=benji][bug=677532, 869089][incr] Good riddance to official_rosetta.

Show diffs side-by-side

added added

removed removed

Lines of Context:
378
378
        dbName='official_blueprints', notNull=True, default=False)
379
379
    official_malone = BoolCol(
380
380
        dbName='official_malone', notNull=True, default=False)
381
 
    official_rosetta = BoolCol(
382
 
        dbName='official_rosetta', notNull=True, default=False)
383
381
    remote_product = Unicode(
384
382
        name='remote_product', allow_none=True, default=None)
385
383
    max_bug_heat = Int()
403
401
 
404
402
    @property
405
403
    def official_anything(self):
406
 
        return True in (self.official_malone, self.official_rosetta,
 
404
        return True in (self.official_malone,
 
405
                        self.translations_usage == ServiceUsage.LAUNCHPAD,
407
406
                        self.official_blueprints, self.official_answers,
408
407
                        self.official_codehosting)
409
408
 
415
414
        dbName="blueprints_usage", notNull=True,
416
415
        schema=ServiceUsage,
417
416
        default=ServiceUsage.UNKNOWN)
418
 
    _translations_usage = EnumCol(
 
417
    translations_usage = EnumCol(
419
418
        dbName="translations_usage", notNull=True,
420
419
        schema=ServiceUsage,
421
420
        default=ServiceUsage.UNKNOWN)
694
693
        _set_blueprints_usage,
695
694
        doc="Indicates if the product uses the blueprints service.")
696
695
 
697
 
    def _get_translations_usage(self):
698
 
        if self._translations_usage != ServiceUsage.UNKNOWN:
699
 
            # If someone has set something with the enum, use it.
700
 
            return self._translations_usage
701
 
        elif self.official_rosetta:
702
 
            return ServiceUsage.LAUNCHPAD
703
 
        return self._translations_usage
704
 
 
705
 
    def _set_translations_usage(self, val):
706
 
        self._translations_usage = val
707
 
        if val == ServiceUsage.LAUNCHPAD:
708
 
            self.official_rosetta = True
709
 
        else:
710
 
            self.official_rosetta = False
711
 
 
712
 
    translations_usage = property(
713
 
        _get_translations_usage,
714
 
        _set_translations_usage,
715
 
        doc="Indicates if the product uses the translations service.")
716
 
 
717
696
    @cachedproperty
718
697
    def _cached_licenses(self):
719
698
        """Get the licenses as a tuple."""
1670
1649
 
1671
1650
    def getTranslatables(self):
1672
1651
        """See `IProductSet`"""
1673
 
        # XXX j.c.sackett 2010-11-19 bug=677532 It's less than ideal that
1674
 
        # this query is using _translations_usage, but there's no cleaner
1675
 
        # way to deal with it. Once the bug above is resolved, this should
1676
 
        # should be fixed to use translations_usage.
1677
1652
        results = IStore(Product).find(
1678
1653
            (Product, Person),
1679
1654
            Product.active == True,
1680
1655
            Product.id == ProductSeries.productID,
1681
1656
            POTemplate.productseriesID == ProductSeries.id,
1682
 
            Product._translations_usage == ServiceUsage.LAUNCHPAD,
 
1657
            Product.translations_usage == ServiceUsage.LAUNCHPAD,
1683
1658
            Person.id == Product._ownerID).config(
1684
1659
                distinct=True).order_by(Product.title)
1685
1660