Skip to content

Commit

Permalink
Fixed setting attributes on the 5 readonly @Property
Browse files Browse the repository at this point in the history
member_ids, short_id, list_id, board_id, and description
are readonly properties.

Changed to direct access the underlying variables:
 - idMembers
 - idShort
 - idList
 - idBoard
 - desc
  • Loading branch information
kennethzfeng committed May 5, 2014
1 parent 9422a9b commit aabe9be
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions trello/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,10 @@ def list_cards(self):
cards = list()
for c in json_obj:
card = Card(self, c['id'], name=c['name'].encode('utf-8'))
card.description = c.get('desc', '').encode('utf-8')
card.desc = c.get('desc', '').encode('utf-8')
card.closed = c['closed']
card.url = c['url']
card.member_ids = c['idMembers']
card.idMembers = c['idMembers']
cards.append(card)
return cards

Expand All @@ -428,10 +428,10 @@ def add_card(self, name, desc=None):
post_args={'name': name, 'idList': self.id, 'desc': desc}, )
card = Card(self, json_obj['id'])
card.name = json_obj['name']
card.description = json_obj.get('desc', '')
card.desc = json_obj.get('desc', '')
card.closed = json_obj['closed']
card.url = json_obj['url']
card.member_ids = json_obj['idMembers']
card.idMembers = json_obj['idMembers']
return card

def fetch_actions(self, action_filter):
Expand Down Expand Up @@ -503,13 +503,13 @@ def fetch(self):
'/cards/' + self.id,
query_params={'badges': False})
self.name = json_obj['name'].encode('utf-8')
self.description = json_obj.get('desc', '')
self.desc = json_obj.get('desc', '')
self.closed = json_obj['closed']
self.url = json_obj['url']
self.member_ids = json_obj['idMembers']
self.short_id = json_obj['idShort']
self.list_id = json_obj['idList']
self.board_id = json_obj['idBoard']
self.idMembers = json_obj['idMembers']
self.idShort = json_obj['idShort']
self.idList = json_obj['idList']
self.idBoard = json_obj['idBoard']
self.labels = json_obj['labels']
self.badges = json_obj['badges']
self.due = json_obj['due']
Expand Down Expand Up @@ -547,7 +547,7 @@ def create_date(self):

def set_description(self, description):
self._set_remote_attribute('desc', description)
self.description = description
self.desc = description

def set_due(self, due):
"""Set the due time for the card
Expand Down

0 comments on commit aabe9be

Please sign in to comment.