diff options
author | Dylann Cordel <cordel.d@free.fr> | 2021-04-22 17:44:39 +0200 |
---|---|---|
committer | Dylann Cordel <cordel.d@free.fr> | 2021-04-22 17:44:39 +0200 |
commit | 3ba27ffb6ae995c27608f84eef0abe636e2e63da (patch) | |
tree | d036be7529949a65aa3d201fcbda7389962dad65 /gitlab/client.py | |
parent | 60c5fd8878ff54f6e3fcd168545ab3af139f1dcc (diff) | |
download | gitlab-3ba27ffb6ae995c27608f84eef0abe636e2e63da.tar.gz |
fix: update user's bool data and avatar
If we want to update email, avatar and do not send email
confirmation change (`skip_reconfirmation` = True), `MultipartEncoder`
will try to encode everything except None and bytes. So it tries to encode bools.
Casting bool's values to their stringified int representation fix it.
Diffstat (limited to 'gitlab/client.py')
-rw-r--r-- | gitlab/client.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gitlab/client.py b/gitlab/client.py index 7927b3f..3f28eb9 100644 --- a/gitlab/client.py +++ b/gitlab/client.py @@ -505,6 +505,12 @@ class Gitlab(object): json = None if post_data is None: post_data = {} + else: + # booleans does not exists for data (neither for MultipartEncoder): + # cast to string int to avoid: 'bool' object has no attribute 'encode' + for k, v in post_data.items(): + if isinstance(v, bool): + post_data[k] = str(int(v)) post_data["file"] = files.get("file") post_data["avatar"] = files.get("avatar") data = MultipartEncoder(post_data) |