~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# Copyright 2010-2011 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

"""Interfaces for the Launchpad application.

Note that these are not interfaces to application content objects.
"""

__metaclass__ = type

__all__ = [
    'IAging',
    'IHasDateCreated',
    'IHasIcon',
    'IHasLogo',
    'IHasMugshot',
    'ILaunchpadCelebrities',
    'ILaunchpadUsage',
    'IPrivacy',
    'IServiceUsage',
    ]

from lazr.restful.declarations import exported
from zope.interface import (
    Attribute,
    Interface,
    )
from zope.schema import (
    Bool,
    Choice,
    )

from lp import _
from lp.app.enums import ServiceUsage


class ILaunchpadCelebrities(Interface):
    """Well known things.

    Celebrities are SQLBase instances that have a well known name.
    """
    admin = Attribute("The 'admins' team.")
    software_center_agent = Attribute("The Software Center Agent.")
    bug_importer = Attribute("The bug importer.")
    bug_watch_updater = Attribute("The Bug Watch Updater.")
    buildd_admin = Attribute("The Build Daemon administrator.")
    commercial_admin = Attribute("The Launchpad Commercial team.")
    debbugs = Attribute("The Debian Bug Tracker")
    debian = Attribute("The Debian Distribution.")
    english = Attribute("The English language.")
    gnome_bugzilla = Attribute("The Gnome Bugzilla.")
    hwdb_team = Attribute("The HWDB team.")
    janitor = Attribute("The Launchpad Janitor.")
    katie = Attribute("The Debian Auto-sync user.")
    launchpad = Attribute("The Launchpad project.")
    launchpad_developers = Attribute("The Launchpad development team.")
    obsolete_junk = Attribute("The Obsolete Junk project.")
    ppa_key_guard = Attribute("The PPA signing keys owner.")
    registry_experts = Attribute("The Registry Administrators team.")
    rosetta_experts = Attribute("The Rosetta Experts team.")
    savannah_tracker = Attribute("The GNU Savannah Bug Tracker.")
    sourceforge_tracker = Attribute("The SourceForge Bug Tracker")
    ubuntu = Attribute("The Ubuntu Distribution.")
    ubuntu_archive_mirror = Attribute("The main archive mirror for Ubuntu.")
    ubuntu_bugzilla = Attribute("The Ubuntu Bugzilla.")
    ubuntu_cdimage_mirror = Attribute("The main cdimage mirror for Ubuntu.")
    ubuntu_security = Attribute("The 'ubuntu-security' team.")
    ubuntu_techboard = Attribute("The Ubuntu technical board.")
    vcs_imports = Attribute("The 'vcs-imports' team.")

    def isCelebrityPerson(name):
        """Return true if there is an IPerson celebrity with the given name.
        """


class IServiceUsage(Interface):
    """Pillar service usages."""

    # XXX: BradCrittenden 2010-08-06 bug=n/a:  I hate using the term 'pillar'
    # but cannot use 'project' or 'distribution'.  The phrase 'Where does'
    # implies an actual location not an answer of "Launchpad, externally, or
    # neither."
    answers_usage = Choice(
        title=_('Type of service for answers application'),
        description=_("Where does this pillar have an Answers forum?"),
        default=ServiceUsage.UNKNOWN,
        vocabulary=ServiceUsage)
    blueprints_usage = Choice(
        title=_('Type of service for blueprints application'),
        description=_("Where does this pillar host blueprints?"),
        default=ServiceUsage.UNKNOWN,
        vocabulary=ServiceUsage)
    codehosting_usage = Choice(
        title=_('Type of service for hosting code'),
        description=_("Where does this pillar host code?"),
        default=ServiceUsage.UNKNOWN,
        vocabulary=ServiceUsage)
    translations_usage = exported(Choice(
        title=_('Type of service for translations application'),
        description=_("Where does this pillar do translations?"),
        default=ServiceUsage.UNKNOWN,
        vocabulary=ServiceUsage), as_of="devel")
    bug_tracking_usage = Choice(
        title=_('Type of service for tracking bugs'),
        description=_("Where does this pillar track bugs?"),
        default=ServiceUsage.UNKNOWN,
        vocabulary=ServiceUsage)
    uses_launchpad = Bool(
        title=_('Uses Launchpad for something.'))


class ILaunchpadUsage(Interface):
    """How the project uses Launchpad."""
    official_answers = Bool(
        title=_('People can ask questions in Launchpad Answers'),
        required=True)
    official_blueprints = Bool(
        title=_('This project uses blueprints'), required=True)
    official_codehosting = Bool(
        title=_('Code for this project is published in Bazaar branches on'
                ' Launchpad'),
        required=True)
    official_malone = Bool(
        title=_('Bugs in this project are tracked in Launchpad'),
        required=True)
    official_anything = Bool(
        title=_('Uses Launchpad for something'))
    enable_bug_expiration = Bool(
        title=_('Expire "Incomplete" bug reports when they become inactive'),
        required=True)


class IHasIcon(Interface):
    """An object that can have a custom icon."""

    # Each of the objects that implements this needs a custom schema, so
    # here we can just use Attributes
    icon = Attribute("The 14x14 icon.")


class IHasLogo(Interface):
    """An object that can have a custom logo."""

    # Each of the objects that implements this needs a custom schema, so
    # here we can just use Attributes
    logo = Attribute("The 64x64 logo.")


class IHasMugshot(Interface):
    """An object that can have a custom mugshot."""

    # Each of the objects that implements this needs a custom schema, so
    # here we can just use Attributes
    mugshot = Attribute("The 192x192 mugshot.")


class IAging(Interface):
    """Something that gets older as time passes."""

    def currentApproximateAge():
        """Return a human-readable string of how old this thing is.

        Values returned are things like '2 minutes', '3 hours',
        '1 month', etc.
        """


class IPrivacy(Interface):
    """Something that can be private."""

    private = Bool(
        title=_("This is private"),
        required=False,
        description=_(
            "Private objects are visible to members or subscribers."))


class IHasDateCreated(Interface):
    """Something created on a certain date."""

    datecreated = Attribute("The date on which I was created.")