~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/soyuz/interfaces/copypolicy.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-05-23 18:43:31 UTC
  • mfrom: (13084.2.6 page-match-rewrite-url)
  • Revision ID: launchpad@pqm.canonical.com-20110523184331-dhd2c7cgfuu49epw
[r=sinzui][bug=784273] Adds facility to the PageMatch to handle bad
        URIs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2011 Canonical Ltd.  This software is licensed under the
2
 
# GNU Affero General Public License version 3 (see the file LICENSE).
3
 
 
4
 
"""Package copy policies."""
5
 
 
6
 
__metaclass__ = type
7
 
__all__ = [
8
 
    'ICopyPolicy',
9
 
    ]
10
 
 
11
 
 
12
 
from zope.interface import Interface
13
 
from zope.schema import (
14
 
    Bool,
15
 
    Choice,
16
 
    )
17
 
 
18
 
from canonical.launchpad import _
19
 
from lp.soyuz.enums import PackageCopyPolicy
20
 
 
21
 
 
22
 
class ICopyPolicy(Interface):
23
 
    """Policies for copying packages, as enumerated by `PackageCopyPolicy`."""
24
 
 
25
 
    enum_value = Choice(
26
 
        title=_("PackageCopyPolicy number associated with this policy."),
27
 
        values=PackageCopyPolicy, readonly=True, required=True)
28
 
 
29
 
    send_email = Bool(
30
 
        title=_("Should completion of this copy be announced by email?"),
31
 
        readonly=True, required=True)
32
 
 
33
 
    def autoApprove(archive, distroseries, pocket):
34
 
        """Can this upload of a known package be approved automatically?
35
 
 
36
 
        This should only be called for packages that are known not new.
37
 
 
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.
43
 
        """
44
 
 
45
 
    def autoApproveNew(archive, distroseries, pocket):
46
 
        """Can this upload of a new package be approved automatically?
47
 
 
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.
53
 
        """