Skip to content

Commit

Permalink
Merge pull request #44 from xfguo/master
Browse files Browse the repository at this point in the history
Rename an item for a Checklist.
  • Loading branch information
sarumont committed May 21, 2014
2 parents 9422a9b + 9919f25 commit 8a1c24f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions trello/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,29 @@ def set_checklist_item(self, name, checked):
self.items[ix] = json_obj
return json_obj

def rename_checklist_item(self, name, new_name):
"""Rename the item on this checklist
:name: name of the checklist item
:new_name: new name of item
"""

# Locate the id of the checklist item
try:
[ix] = [i for i in range(len(self.items)) if self.items[i]['name'] == name]
except ValueError:
return

json_obj = self.client.fetch_json(
'/cards/'+self.trello_card+\
'/checklist/'+self.id+\
'/checkItem/'+self.items[ix]['id'],
http_method = 'PUT',
post_args = {'name' : new_name})

self.items[ix] = json_obj
return json_obj

def __repr__(self):
return '<Checklist %s>' % self.id

Expand Down

0 comments on commit 8a1c24f

Please sign in to comment.