~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/model/archive.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-07-22 08:55:33 UTC
  • mfrom: (13482.3.2 no-copyPackage-with-ppa)
  • Revision ID: launchpad@pqm.canonical.com-20110722085533-0k8pcgrzr22telnv
[r=julian-edwards][no-qa] Prevent use of
 IArchive.copyPackage/copyPackages when the destination is a PPA because we
 don't yet have a way to give failure feedback.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1532
1532
            [source], to_pocket, to_series, include_binaries,
1533
1533
            person=person)
1534
1534
 
 
1535
    def _checkCopyPackageFeatureFlags(self):
 
1536
        """Prevent copyPackage(s) if these conditions are not met."""
 
1537
        if not getFeatureFlag(u"soyuz.copypackage.enabled"):
 
1538
            raise ForbiddenByFeatureFlag
 
1539
        if (self.is_ppa and 
 
1540
            not getFeatureFlag(u"soyuz.copypackageppa.enabled")):
 
1541
            # We have no way of giving feedback about failed jobs yet,
 
1542
            # so this is disabled for now.
 
1543
            raise ForbiddenByFeatureFlag(
 
1544
                "Not enabled for copying to PPAs yet.")
 
1545
 
1535
1546
    def copyPackage(self, source_name, version, from_archive, to_pocket,
1536
1547
                    person, to_series=None, include_binaries=False):
1537
1548
        """See `IArchive`."""
1538
 
        if not getFeatureFlag(u"soyuz.copypackage.enabled"):
1539
 
            raise ForbiddenByFeatureFlag
 
1549
        self._checkCopyPackageFeatureFlags()
1540
1550
 
1541
1551
        # Asynchronously copy a package using the job system.
1542
1552
        pocket = self._text_to_pocket(to_pocket)
1559
1569
    def copyPackages(self, source_names, from_archive, to_pocket,
1560
1570
                     person, to_series=None, include_binaries=None):
1561
1571
        """See `IArchive`."""
1562
 
        if not getFeatureFlag(u"soyuz.copypackage.enabled"):
1563
 
            raise ForbiddenByFeatureFlag
 
1572
        self._checkCopyPackageFeatureFlags()
1564
1573
 
1565
1574
        sources = self._collectLatestPublishedSources(
1566
1575
            from_archive, source_names)