Skip to content

Commit

Permalink
Add limit param to card comments (now is limited to 50 by default)
Browse files Browse the repository at this point in the history
  • Loading branch information
jespino committed Oct 26, 2016
1 parent dfab2e2 commit 814c2a4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions trello/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,16 @@ def fetch(self, eager=True):
self._comments = self.fetch_comments() if eager else None
self._attachments = self.fetch_attachments() if eager else None

def fetch_comments(self, force=False):
def fetch_comments(self, force=False, limit=None):
comments = []

if (force is True) or (self.badges['comments'] > 0):
query_params = {'filter': 'commentCard'}
if limit is not None:
query_params['limit'] = limit
comments = self.client.fetch_json(
'/cards/' + self.id + '/actions',
query_params={'filter': 'commentCard'})
query_params=query_params)
return sorted(comments, key=lambda comment: comment['date'])
return comments

Expand Down

0 comments on commit 814c2a4

Please sign in to comment.