~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/answers/interfaces/questionsubscription.py

  • Committer: Curtis Hovey
  • Date: 2011-05-27 21:53:34 UTC
  • mto: This revision was merged to the branch mainline in revision 13136.
  • Revision ID: curtis.hovey@canonical.com-20110527215334-jqlkmt52nnl4bpeh
Moved launchpad.event into registry interfaces.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
    'IQuestionSubscription',
12
12
    ]
13
13
 
14
 
from lazr.restful.declarations import (
15
 
    export_as_webservice_entry,
16
 
    exported,
17
 
    )
18
 
from lazr.restful.fields import Reference
19
 
 
20
 
from zope.interface import Interface
21
 
from zope.schema import (
22
 
    Datetime,
23
 
    Int,
24
 
    )
25
 
 
26
 
from canonical.launchpad import _
27
 
from lp.services.fields import PersonChoice
 
14
from zope.interface import (
 
15
    Attribute,
 
16
    Interface,
 
17
    )
28
18
 
29
19
 
30
20
class IQuestionSubscription(Interface):
31
21
    """A subscription for a person to a question."""
32
22
 
33
 
    export_as_webservice_entry(publish_web_link=False, as_of='devel')
34
 
 
35
 
    id = Int(title=_('ID'), readonly=True, required=True)
36
 
    person = exported(PersonChoice(
37
 
        title=_('Person'), required=True, vocabulary='ValidPersonOrTeam',
38
 
        readonly=True, description=_("The person's Launchpad ID or "
39
 
        "e-mail address.")), as_of="devel")
40
 
    question = exported(Reference(
41
 
        Interface, title=_("Question"), required=True, readonly=True),
42
 
        as_of="devel")
43
 
    date_created = exported(
44
 
        Datetime(title=_('Date subscribed'), required=True, readonly=True),
45
 
        as_of="devel")
46
 
 
47
 
    def canBeUnsubscribedByUser(user):
48
 
        """Can the user unsubscribe the subscriber from the question?"""
 
23
    person = Attribute("The subscriber.")
 
24
    question = Attribute("The question.")
 
25