Updating card flags

In the latest version it is advised to use col.set_user_flag_for_cards() instead of card.set_user_flag(). However, after changing the code from one call to the other I can’t set user flags anymore. The function succeeds but doesn’t change anything.

If you’re checking the state of a card object, did you call card.load() after the database was modified?

No, I didn’t. The code is as follows:

color_code = 1
col.set_user_flag_for_cards(color_code, cids=[card.id, ])

When I swap col.set_user_flag_for_cards(color_code, cids=[card.id, ]) for card.set_user_flag(color_code) it works as expected.

You’re overwriting the updated flag with col.update_card(card). Just delete this line.
As @dae has said, you can call card.load() to reload the card object with the new flag.


Thanks, I’ll test it.

Update: removing col.update_card(card) actually solves it!