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
|
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Distribution series difference messages."""
__metaclass__ = type
__all__ = [
'IDistroSeriesDifferenceComment',
'IDistroSeriesDifferenceCommentSource',
]
from lazr.restful.declarations import (
export_as_webservice_entry,
exported,
)
from lazr.restful.fields import Reference
from zope.interface import Interface
from zope.schema import (
Datetime,
Int,
Text,
)
from canonical.launchpad import _
from lp.services.messages.interfaces.message import IMessage
from lp.registry.interfaces.distroseriesdifference import (
IDistroSeriesDifference,
)
class IDistroSeriesDifferenceComment(Interface):
"""A comment for a distroseries difference record."""
export_as_webservice_entry()
id = Int(title=_('ID'), required=True, readonly=True)
distro_series_difference = Reference(
IDistroSeriesDifference, title=_("Distro series difference"),
required=True, readonly=True, description=_(
"The distro series difference to which this message "
"belongs."))
message = Reference(
IMessage, title=_("Message"), required=True, readonly=True,
description=_("A comment about this difference."))
body_text = exported(Text(
title=_("Comment text"), readonly=True, description=_(
"The comment text for the related distro series difference.")))
comment_author = exported(Reference(
# Really IPerson.
Interface, title=_("The author of the comment."),
readonly=True))
comment_date = exported(Datetime(
title=_('Comment date.'), readonly=True))
class IDistroSeriesDifferenceCommentSource(Interface):
"""A utility of this interface can be used to create comments."""
def new(distro_series_difference, owner, comment):
"""Create a new comment on a distro series difference.
:param distro_series_difference: The distribution series difference
that is being commented on.
:param owner: The person making the comment.
:param comment: The comment.
:return: A new `DistroSeriesDifferenceComment` object.
"""
def getForDifference(distro_series_difference, id):
"""Return the `IDistroSeriesDifferenceComment` with the given id."""
|