Skip to content

Commit

Permalink
enhance trellolist list_cards
Browse files Browse the repository at this point in the history
  • Loading branch information
tclh123 committed Apr 5, 2017
1 parent cc7d685 commit f172a49
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ dist
.pydevproject
.idea/
.tox/
.DS_Store
.DS_Store

/tmp
/venv
2 changes: 2 additions & 0 deletions trello/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ def from_json(cls, parent, json_obj):
card._attachments = []
for attachment_json in json_obj["attachments"]:
card._attachments.append(attachment_json)
if 'actions' in json_obj:
card.actions = json_obj['actions']
return card

def __repr__(self):
Expand Down
10 changes: 8 additions & 2 deletions trello/trellolist.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ def fetch(self):
self.closed = json_obj['closed']
self.pos = json_obj['pos']

def list_cards(self, card_filter="open"):
def list_cards(self, card_filter="open", actions=None):
"""Lists all cards in this list"""
json_obj = self.client.fetch_json('/lists/' + self.id + '/cards/' + card_filter)
query_params = {}
if card_filter:
query_params['filter'] = card_filter
if actions:
query_params['actions'] = actions
json_obj = self.client.fetch_json('/lists/' + self.id + '/cards',
query_params=query_params)
return [Card.from_json(self, c) for c in json_obj]

def add_card(self, name, desc=None, labels=None, due="null", source=None, position=None):
Expand Down

0 comments on commit f172a49

Please sign in to comment.