~launchpad-pqm/launchpad/devel

7675.776.1 by Brad Crittenden
Added ServiceUsage and corresponding columns for product and distribution.
1
# Copyright 2010 Canonical Ltd.  This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
11472.3.1 by j.c.sackett
Updated all nontest callsites in the code.
4
"""Enumerations and related utilities used in the lp/app modules."""
7675.776.1 by Brad Crittenden
Added ServiceUsage and corresponding columns for product and distribution.
5
6
__metaclass__ = type
7
__all__ = [
8
    'ServiceUsage',
11472.3.1 by j.c.sackett
Updated all nontest callsites in the code.
9
    'service_uses_launchpad',
7675.776.1 by Brad Crittenden
Added ServiceUsage and corresponding columns for product and distribution.
10
    ]
11
11403.1.4 by Henning Eggers
Reformatted imports using format-imports script r32.
12
from lazr.enum import (
13
    DBEnumeratedType,
14
    DBItem,
15
    )
7675.776.1 by Brad Crittenden
Added ServiceUsage and corresponding columns for product and distribution.
16
17
18
class ServiceUsage(DBEnumeratedType):
19
    """Launchpad application usages.
20
21
    Indication of a pillar's usage of Launchpad for the various services:
22
    bug tracking, translations, code hosting, blueprint, and answers.
23
    """
24
25
    UNKNOWN = DBItem(10, """
26
    Unknown
27
28
    The maintainers have not indicated usage.  This value is the default for
29
    new pillars.
30
    """)
31
32
    LAUNCHPAD = DBItem(20, """
33
    Launchpad
34
35
    Launchpad is used to provide this service.
36
    """)
37
38
    EXTERNAL = DBItem(30, """
39
    External
40
41
    The service is provided external to Launchpad.
42
    """)
43
44
    NOT_APPLICABLE = DBItem(40, """
45
    Not Applicable
46
47
    The pillar does not use this type of service in Launchpad or externally.
48
    """)
11472.3.1 by j.c.sackett
Updated all nontest callsites in the code.
49
50
51
def service_uses_launchpad(usage_enum):
52
    return usage_enum == ServiceUsage.LAUNCHPAD