python-intercom
python-intercom copied to clipboard
__setattr__ overriding causing some unexpected behavior
I was attempting to add companies to a user by using:
user.companies.append({"company_id": "abc123", "name": "Test Company"})
Since this doesn't trigger __setattr__, it's never marked for sending to the API when save() is called.
I'm not sure if this issue is a priority for you, or what a decent solution might be, but it had me pulling my hair out before I realized what was going on. It seems like this might be something of a design flaw in the way the library works.
Workaround is:
companies = user.companies
companies.append({"company_id": "abc123", "name": "Test Company"})
user.companies = companies