Skip to content
4 changes: 2 additions & 2 deletions bugzilla/bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,14 @@ def addcomment(self, comment, private=False):

return self.bugzilla.update_bugs(self.bug_id, vals)

def getcomments(self):
def get_comments(self):
"""
Returns an array of comment dictionaries for this bug
"""
comment_list = self.bugzilla.get_comments([self.bug_id])
return comment_list['bugs'][str(self.bug_id)]['comments']


getcomments = get_comments
#####################
# Get/Set bug flags #
#####################
Expand Down
4 changes: 2 additions & 2 deletions examples/getbug.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

# comments must be fetched separately on stock bugzilla. this just returns
# a raw dict with all the info.
comments = bug.getcomments()
comments = bug.get_comments()
print("\nLast comment data:\n%s" % pprint.pformat(comments[-1]))

# getcomments is just a wrapper around bzapi.get_comments(), which can be
# get_comments is just a wrapper around bzapi.get_comments(), which can be
# used for bulk comments fetching
4 changes: 2 additions & 2 deletions examples/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@


# Now let's add a comment
comments = bug.getcomments()
comments = bug.get_comments()
print("Bug originally has %d comments" % len(comments))

update = bzapi.build_update(comment="new example comment %s" % time.time())
bzapi.update_bugs([bug.id], update)

# refresh() actually isn't required here because comments are fetched
# on demand
comments = bug.getcomments()
comments = bug.get_comments()
print("Bug now has %d comments. Last comment=%s" % (len(comments),
comments[-1]["text"]))

Expand Down
1 change: 1 addition & 0 deletions tests/test_api_bug.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ def _get_fake_bug(apiname):
# Stub API testing
bug = fakebz.getbug(1165434)
bug.get_history_raw()
bug.get_comments()
bug.getcomments()

# Some hackery to hit a few attachment code paths
Expand Down
5 changes: 4 additions & 1 deletion tests/test_rw_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,11 @@ def test05ModifyStatus(run_cli, backends):
assert bug.longdescs[-1]["text"] == comment
assert bug.longdescs[-1]["is_private"] == 0

# Confirm comments is same as getcomments
# Confirm comments is same as get_comments
assert bug.comments == bug.get_comments()
# This method will be removed in a future version
assert bug.comments == bug.getcomments()
assert bug.get_comments() == bug.getcomments()

# Reset state
run_cli(cmd + "--status %s" % origstatus, bz)
Expand Down