~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

Merge db-devel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
    'IQuestionMessage',
12
12
    ]
13
13
 
 
14
from zope.interface import Interface
14
15
from zope.schema import (
15
16
    Bool,
16
17
    Choice,
17
 
    Field,
18
18
    Int,
19
19
    )
20
20
 
 
21
from lazr.restful.declarations import (
 
22
    export_as_webservice_entry,
 
23
    exported,
 
24
    )
 
25
from lazr.restful.fields import Reference
 
26
 
21
27
from canonical.launchpad import _
22
 
from canonical.launchpad.interfaces.message import IMessage
 
28
from lp.services.messages.interfaces.message import IMessage
23
29
from lp.answers.enums import (
24
30
    QuestionAction,
25
31
    QuestionStatus,
31
37
 
32
38
    It adds attributes to the IMessage interface.
33
39
    """
 
40
    export_as_webservice_entry(as_of='devel')
 
41
 
34
42
    # This is really an Object field with schema=IQuestion, but that
35
43
    # would create a circular dependency between IQuestion
36
44
    # and IQuestionMessage
37
 
    question = Field(
38
 
        title=_("The question related to this message."),
39
 
        description=_("An IQuestion object."), required=True, readonly=True)
40
 
 
41
 
    action = Choice(
 
45
    question = exported(Reference(
 
46
        title=_("The question related to this message."), schema=Interface,
 
47
        description=_("An IQuestion object."), required=True, readonly=True),
 
48
        as_of="devel")
 
49
    action = exported(Choice(
42
50
        title=_("Action operated on the question by this message."),
43
51
        required=True, readonly=True, default=QuestionAction.COMMENT,
44
 
        vocabulary=QuestionAction)
45
 
 
46
 
    new_status = Choice(
 
52
        vocabulary=QuestionAction),
 
53
        as_of="devel")
 
54
    new_status = exported(Choice(
47
55
        title=_("Question status after message"),
48
56
        description=_("The status of the question after the transition "
49
57
        "related the action operated by this message."), required=True,
50
58
        readonly=True, default=QuestionStatus.OPEN,
51
 
        vocabulary=QuestionStatus)
 
59
        vocabulary=QuestionStatus),
 
60
        as_of="devel")
52
61
    index = Int(
53
62
        title=_("Message index."),
54
 
        description=_("The messages index in the question's list of "
 
63
        description=_("The messages 0-index in the question's list of "
55
64
        "messages."),
56
65
        readonly=True)
57
 
    visible = Bool(
 
66
    display_index = exported(Int(
 
67
        title=_("Human readable Message index."),
 
68
        description=_("The message's index in the question's list of "
 
69
        "messages."),
 
70
        readonly=True), exported_as='index')
 
71
    visible = exported(Bool(
58
72
        title=_("Message visibility."),
59
73
        description=_("Whether or not the message is visible."),
60
 
        readonly=True)
 
74
        readonly=True),
 
75
        as_of="devel")