Skip to content

Commit

Permalink
Merge branch 'master' into dev2
Browse files Browse the repository at this point in the history
  • Loading branch information
sarumont authored Apr 10, 2017
2 parents f172a49 + ca86d8f commit 27a3d39
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ dist
.idea/
.tox/
.DS_Store

/tmp
/venv
example
18 changes: 18 additions & 0 deletions trello/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ def checklists(self):
self._checklists = None
return self._checklists

@property
def plugin_data(self):
"""
Lazily loads and returns the plugin data
"""
try:
if self._plugin_data is None:
self._plugin_data = self.fetch_plugin_data()
except AttributeError:
self._plugin_data = None
return self._plugin_data

@property
def attachments(self):
"""
Expand Down Expand Up @@ -185,6 +197,7 @@ def fetch(self, eager=True):
self.checked = json_obj['checkItemStates']
self.dateLastActivity = dateparser.parse(json_obj['dateLastActivity'])

self._plugin_data = self.fetch_plugin_data() if eager else None
self._checklists = self.fetch_checklists() if eager else None
self._comments = self.fetch_comments() if eager else None
self._attachments = self.fetch_attachments() if eager else None
Expand Down Expand Up @@ -228,6 +241,11 @@ def fetch_checklists(self):
trello_card=self.id))
return checklists

def fetch_plugin_data(self):
items = self.client.fetch_json(
'/cards/' + self.id + '/pluginData')
return items

def fetch_attachments(self, force=False):
if (force is True) or (self.badges['attachments'] > 0):
items = self.client.fetch_json(
Expand Down

0 comments on commit 27a3d39

Please sign in to comment.