From f172a49e06ae81db78bf6899057d2fe56d75dcd8 Mon Sep 17 00:00:00 2001 From: lihan Date: Wed, 5 Apr 2017 11:31:21 +0800 Subject: [PATCH] enhance trellolist list_cards --- .gitignore | 5 ++++- trello/card.py | 2 ++ trello/trellolist.py | 10 ++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 3ac32710..9772e529 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,7 @@ dist .pydevproject .idea/ .tox/ -.DS_Store \ No newline at end of file +.DS_Store + +/tmp +/venv diff --git a/trello/card.py b/trello/card.py index cf937c34..60712f12 100644 --- a/trello/card.py +++ b/trello/card.py @@ -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): diff --git a/trello/trellolist.py b/trello/trellolist.py index 4290101c..ebadae83 100644 --- a/trello/trellolist.py +++ b/trello/trellolist.py @@ -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):