Closed adinklotz closed 4 years ago
Thanks, @adinklotz - merged and will push to PyPi shortly!
Run python3.8 main.py emails
Traceback (most recent call last):
File "main.py", line 14, in <module>
from trello import TrelloClient
File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trello/__init__.py", line 3, in <module>
from trello.board import *
File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trello/board.py", line 6, in <module>
from trello.card import Card
File "/opt/hostedtoolcache/Python/3.8.5/x64/lib/python3.8/site-packages/trello/card.py", line 586
post_args = {'idValue': list_field_id}
^
IndentationError: unexpected unindent
##[error]Process completed with exit code 1.
@justinpw Yuuup. Fixed it in #316 , but I'm feeling very foolish, and it looks like this one somehow already made it all the way to pyPI without getting caught.
The Trello API allows clearing a custom field's value by sending an empty PUT request (see https://developer.atlassian.com/cloud/trello/guides/rest-api/getting-started-with-custom-fields/#clearing-customfielditems). In keeping with that, this commit allows the
card.set_custom_field
method to clear the given custom field when passed an empty string. It's very simple - if the value is empty, it skips giving it a type and just sends the empty JSON, causing the field in Trello to be unset.In the future, having a dedicated
clear_custom_field
may make more sense, but I decided to put the functionality inset_custom_field
so as to match the structure of the actual REST API more closelyThis change has not been formally tested, since the provided test suite doesn't test custom fields and I didn't get around to writing my own, but anecdotally, I've been using this version of the method on my own system for a while with no issue