IssueComment

This commit is contained in:
Vincent Jacques
2012-02-24 17:10:02 +00:00
parent 01e049391a
commit c3db56f0fd
4 changed files with 34 additions and 6 deletions
+17
View File
@@ -142,6 +142,18 @@ Milestone = GithubObject(
ListAttribute( "labels", Label, ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ) ),
)
IssueComment = GithubObject(
"IssueComment",
BaseUrl( lambda obj: obj._repo._baseUrl + "/issues/comment" + str( obj.id ) ),
BasicAttributes(
"url", "body", "created_at", "updated_at", "id",
"_repo", ### Ugly hack
),
ComplexAttribute( "user", NamedUser ),
Editable( [ "body" ], [] ),
Deletable(),
)
Issue = GithubObject(
"Issue",
BaseUrl( lambda obj: obj._repo._baseUrl + "/issues/" + str( obj.number ) ),
@@ -162,6 +174,11 @@ Issue = GithubObject(
ListDeletable(),
ElementRemovable(),
),
ListAttribute( "comments", IssueComment,
ListGetable( [], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ),
ElementGetable( "comment", lambda repo, id: { "_repo": repo, "id": id } ),
ElementCreatable( "comment", [ "body" ], [], lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj._repo }.iteritems() ) ) ),
),
)
__modifyAttributesForObjectsReferingRepo = lambda obj, attributes: dict( itertools.chain( attributes.iteritems(), { "_repo": obj }.iteritems() ) )