~launchpad-pqm/launchpad/devel

8687.15.14 by Karl Fogel
Add the copyright header block to files under lib/lp/blueprints/.
1
# Copyright 2009 Canonical Ltd.  This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
3
4983.1.1 by Curtis Hovey
Added lint exceptions to __init__.py and interface/*.py.
4
# pylint: disable-msg=E0211,E0213
2344 by Canonical.com Patch Queue Manager
[not r=kiko] specification tracker
5
6
"""Specification subscription interfaces."""
7
8
__metaclass__ = type
9
10
__all__ = [
11
    'ISpecificationSubscription',
12
    ]
13
13161.2.2 by Ian Booth
Add canBeUnsubscribedByUser and tests
14
from lazr.restful.declarations import (
15
    call_with,
16
    export_as_webservice_entry,
17
    export_read_operation,
18
    operation_for_version,
19
    REQUEST_USER,
20
    )
13092.1.2 by Robert Collins
Bah. My kingdom for a statically checked language.
21
from zope.interface import (
22
    Attribute,
23
    Interface,
24
    )
11403.1.4 by Henning Eggers
Reformatted imports using format-imports script r32.
25
from zope.schema import (
26
    Bool,
27
    Int,
28
    )
29
2976.10.1 by Stuart Bishop
Zope 3.2 fixes - mainly updating deprecated code
30
from canonical.launchpad import _
14509.1.1 by Ian Booth
Allow private teams to subscribe to blueprints
31
from lp.services.fields import PersonChoice
2344 by Canonical.com Patch Queue Manager
[not r=kiko] specification tracker
32
11403.1.4 by Henning Eggers
Reformatted imports using format-imports script r32.
33
2344 by Canonical.com Patch Queue Manager
[not r=kiko] specification tracker
34
class ISpecificationSubscription(Interface):
35
    """A subscription for a person to a specification."""
36
13161.2.1 by Ian Booth
Export (un)subscribe methods on ISpecification to web service
37
    export_as_webservice_entry(publish_web_link=False, as_of='devel')
38
4682.1.2 by Christian Reis
Snapshots want to grab the ID because of the way our interfaces are structured -- inheriting from SQLBase -- so expose it for spec subscriptions.
39
    id = Int(
40
        title=_('ID'), required=True, readonly=True)
14509.1.1 by Ian Booth
Allow private teams to subscribe to blueprints
41
    person = PersonChoice(
2736.1.16 by Mark Shuttleworth
ability to add someone else as a subscriber
42
            title=_('Subscriber'), required=True,
14509.1.2 by Ian Booth
Fix vocab typo
43
            vocabulary='ValidPersonOrTeam', readonly=True,
3348.1.21 by Mark Shuttleworth
Enable setting and proper use of the "drivers" details.
44
            description=_(
3931.1.17 by Matthew Paul Thomas
Tidies up blueprint-related pages, including finishing the renaming of 'specification' to 'blueprint'.
45
            'The person you would like to subscribe to this blueprint. '
9677.2.1 by Nathan Handler
No need to mention the fact that only valid Launchpad accounts can be
46
            'They will be notified of the subscription by e-mail.')
2344 by Canonical.com Patch Queue Manager
[not r=kiko] specification tracker
47
            )
13092.1.2 by Robert Collins
Bah. My kingdom for a statically checked language.
48
    personID = Attribute('db person value')
2736.1.16 by Mark Shuttleworth
ability to add someone else as a subscriber
49
    specification = Int(title=_('Specification'), required=True,
2344 by Canonical.com Patch Queue Manager
[not r=kiko] specification tracker
50
        readonly=True)
13092.1.2 by Robert Collins
Bah. My kingdom for a statically checked language.
51
    specificationID = Attribute('db specification value')
3986.1.1 by Diogo Matsubara
Fixes 94755 (Clicking on star in blueprint subscribers lead to an oops)
52
    essential = Bool(title=_('Participation essential'), required=True,
3691.73.1 by Mark Shuttleworth
Allow subscribers to be classed as essential to a spec's plan.
53
        description=_('Check this if participation in the design and '
54
        'discussion of the feature is essential. This will '
55
        'cause the meeting scheduler to try to ensure that this person '
56
        'attends meetings about this feature.'),
57
        default=False)
13161.2.2 by Ian Booth
Add canBeUnsubscribedByUser and tests
58
59
    @call_with(user=REQUEST_USER)
60
    @export_read_operation()
61
    @operation_for_version("devel")
62
    def canBeUnsubscribedByUser(user):
63
        """Can the user unsubscribe the subscriber from the specification?"""