1
# Copyright 2011 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Package copy policies."""
12
from zope.interface import Interface
13
from zope.schema import (
18
from canonical.launchpad import _
19
from lp.soyuz.enums import PackageCopyPolicy
22
class ICopyPolicy(Interface):
23
"""Policies for copying packages, as enumerated by `PackageCopyPolicy`."""
26
title=_("PackageCopyPolicy number associated with this policy."),
27
values=PackageCopyPolicy, readonly=True, required=True)
30
title=_("Should completion of this copy be announced by email?"),
31
readonly=True, required=True)
33
def autoApprove(archive, distroseries, pocket):
34
"""Can this upload of a known package be approved automatically?
36
This should only be called for packages that are known not new.
38
:param archive: The target `IArchive` for the upload.
39
:param distroseries: The target `IDistroSeries` for the upload.
40
:param pocket: The target `PackagePublishingPocket` for the upload.
41
:return: True if the upload can be auto-approved, or False if it
42
should be held in the queue.
45
def autoApproveNew(archive, distroseries, pocket):
46
"""Can this upload of a new package be approved automatically?
48
:param archive: The target `IArchive` for the upload.
49
:param distroseries: The target `IDistroSeries` for the upload.
50
:param pocket: The target `PackagePublishingPocket` for the upload.
51
:return: True if the upload can be auto-approved, or False if it
52
should be held in the queue.