From 126e853f6e91c168245be8e20dc136b8ee2e10e7 Mon Sep 17 00:00:00 2001 From: Scott Torborg Date: Sat, 12 Jun 2010 13:30:56 -0700 Subject: [PATCH] Support listing comments on an issue. --- github2/issues.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/github2/issues.py b/github2/issues.py index 5860323..b32d274 100644 --- a/github2/issues.py +++ b/github2/issues.py @@ -17,6 +17,17 @@ class Issue(BaseData): return "" % self.title +class Comment(BaseData): + created_at = DateAttribute("The date this comment was created.") + updated_at = DateAttribute("The date when this comment was last updated.") + body = Attribute("The full text of this comment.") + id = Attribute("The comment id.") + user = Attribute("The username of the user that created this comment.") + + def __repr__(self): + return "" % self.body + + class Issues(GithubCommand): domain = "issues" @@ -59,3 +70,8 @@ class Issues(GithubCommand): return self.make_request("comment", project, str(number), post_data=comment_data, filter='comment') + + def comments(self, project, number): + """View comments on an issue.""" + return self.get_values("comments", project, str(number), + filter="comments", datatype=Comment)