Merge lp:~thumper/launchpad/yet-more-api-exports into lp:launchpad

Proposed by Tim Penhey
Status: Merged
Approved by: Paul Hummer
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~thumper/launchpad/yet-more-api-exports
Merge into: lp:launchpad
Diff against target: 87 lines (+25/-1)
3 files modified
lib/lp/code/interfaces/codereviewcomment.py (+9/-1)
lib/lp/code/model/codereviewcomment.py (+10/-0)
lib/lp/code/stories/webservice/xx-branchmergeproposal.txt (+6/-0)
To merge this branch: bzr merge lp:~thumper/launchpad/yet-more-api-exports
Reviewer Review Type Date Requested Status
Paul Hummer (community) code Approve
Review via email: mp+23905@code.launchpad.net

Commit message

Expose the date created and author of code review comments over the api.

Description of the change

A very simple branch that exposes two more attributes of the code review comment.

Since we are still trying out how to best use the launchpadlib in tests, I've just added the attributes to the current webservice doctest.

tests:
  stories/webservice/xx-branchmergeproposal.txt

To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/code/interfaces/codereviewcomment.py'
--- lib/lp/code/interfaces/codereviewcomment.py 2009-10-21 17:45:53 +0000
+++ lib/lp/code/interfaces/codereviewcomment.py 2010-04-22 10:27:34 +0000
@@ -12,12 +12,13 @@
12 ]12 ]
1313
14from zope.interface import Interface14from zope.interface import Interface
15from zope.schema import Choice, Object, Int, TextLine15from zope.schema import Choice, Datetime, Int, Object, TextLine
1616
17from canonical.launchpad import _17from canonical.launchpad import _
18from lp.code.enums import CodeReviewVote18from lp.code.enums import CodeReviewVote
19from lp.code.interfaces.branchmergeproposal import (19from lp.code.interfaces.branchmergeproposal import (
20 IBranchMergeProposal)20 IBranchMergeProposal)
21from lp.registry.interfaces.person import IPerson
21from canonical.launchpad.interfaces.message import IMessage22from canonical.launchpad.interfaces.message import IMessage
22from lazr.restful.fields import Reference23from lazr.restful.fields import Reference
23from lazr.restful.declarations import (24from lazr.restful.declarations import (
@@ -40,6 +41,13 @@
4041
41 message = Object(schema=IMessage, title=_('The message.'))42 message = Object(schema=IMessage, title=_('The message.'))
4243
44 author = exported(
45 Reference(title=_('Comment Author'), schema=IPerson,
46 required=True, readonly=True))
47
48 date_created = exported(
49 Datetime(title=_('Date Created'), required=True, readonly=True))
50
43 vote = exported(51 vote = exported(
44 Choice(52 Choice(
45 title=_('Review'), required=False,53 title=_('Review'), required=False,
4654
=== modified file 'lib/lp/code/model/codereviewcomment.py'
--- lib/lp/code/model/codereviewcomment.py 2009-10-21 17:45:53 +0000
+++ lib/lp/code/model/codereviewcomment.py 2010-04-22 10:27:34 +0000
@@ -75,6 +75,16 @@
75 vote_tag = StringCol(default=None)75 vote_tag = StringCol(default=None)
7676
77 @property77 @property
78 def author(self):
79 """Defer to the related message."""
80 return self.message.owner
81
82 @property
83 def date_created(self):
84 """Defer to the related message."""
85 return self.message.datecreated
86
87 @property
78 def target(self):88 def target(self):
79 """See `IHasBranchTarget`."""89 """See `IHasBranchTarget`."""
80 return self.branch_merge_proposal.target90 return self.branch_merge_proposal.target
8191
=== modified file 'lib/lp/code/stories/webservice/xx-branchmergeproposal.txt'
--- lib/lp/code/stories/webservice/xx-branchmergeproposal.txt 2010-04-13 15:12:18 +0000
+++ lib/lp/code/stories/webservice/xx-branchmergeproposal.txt 2010-04-22 10:27:34 +0000
@@ -180,7 +180,9 @@
180 2180 2
181 >>> pprint_entry(all_comments['entries'][0])181 >>> pprint_entry(all_comments['entries'][0])
182 as_quoted_email: u'> This is great work'182 as_quoted_email: u'> This is great work'
183 author_link: u'http://api.launchpad.dev/devel/~...'
183 branch_merge_proposal_link: u'http://.../~source/fooix/fix-it/+merge/...'184 branch_merge_proposal_link: u'http://.../~source/fooix/fix-it/+merge/...'
185 date_created: u'...'
184 id: ...186 id: ...
185 message_body: u'This is great work'187 message_body: u'This is great work'
186 resource_type_link: u'http://.../#code_review_comment'188 resource_type_link: u'http://.../#code_review_comment'
@@ -193,7 +195,9 @@
193 ... merge_proposal['self_link'], 'getComment', id=2).jsonBody()195 ... merge_proposal['self_link'], 'getComment', id=2).jsonBody()
194 >>> pprint_entry(comment_2)196 >>> pprint_entry(comment_2)
195 as_quoted_email: u'> This is mediocre work.'197 as_quoted_email: u'> This is mediocre work.'
198 author_link: u'http://api.launchpad.dev/devel/~...'
196 branch_merge_proposal_link: u'http://.../~source/fooix/fix-it/+merge/...'199 branch_merge_proposal_link: u'http://.../~source/fooix/fix-it/+merge/...'
200 date_created: u'...'
197 id: ...201 id: ...
198 message_body: u'This is mediocre work.'202 message_body: u'This is mediocre work.'
199 resource_type_link: u'http://.../#code_review_comment'203 resource_type_link: u'http://.../#code_review_comment'
@@ -264,7 +268,9 @@
264 >>> comment = reviewer_webservice.get(comment_link).jsonBody()268 >>> comment = reviewer_webservice.get(comment_link).jsonBody()
265 >>> pprint_entry(comment)269 >>> pprint_entry(comment)
266 as_quoted_email: u'> This is great work'270 as_quoted_email: u'> This is great work'
271 author_link: u'http://api.launchpad.dev/devel/~...'
267 branch_merge_proposal_link: u'http://.../~source/fooix/fix-it/+merge/...'272 branch_merge_proposal_link: u'http://.../~source/fooix/fix-it/+merge/...'
273 date_created: u'...'
268 id: ...274 id: ...
269 message_body: u'This is great work'275 message_body: u'This is great work'
270 resource_type_link: u'http://.../#code_review_comment'276 resource_type_link: u'http://.../#code_review_comment'