MCPcopy Index your code
hub / github.com/FloatingOctothorpe/python-kanban / update_card

Function update_card

cards.py:75–103  ·  view source on GitHub ↗

Update an existing card

(card_id, json, columns)

Source from the content-addressed store, hash-verified

73 db.session.commit()
74
75def update_card(card_id, json, columns):
76 """Update an existing card"""
77 card = Card.query.get(card_id)
78
79 modified = False
80
81 if 'text' in json:
82 modified = True
83 card.text = json['text']
84
85 if 'color' in json:
86 modified = True
87 card.color = json['color']
88
89 if 'column' in json:
90 if json['column'] in columns:
91 modified = True
92 card.column = json['column']
93 else:
94 raise Exception("Invalid column name: %s" % json['column'])
95
96 if 'archived' in json:
97 modified = True
98 card.archived = json['archived']
99
100 if modified:
101 card.modified = datetime.utcnow()
102
103 db.session.commit()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected