-
Notifications
You must be signed in to change notification settings - Fork 107
Change to projecthook calls to use kwargs allowing for newer params #181
base: develop
Are you sure you want to change the base?
Conversation
data['merge_requests_events'] = int(bool(merge_requests)) | ||
data['tag_push_events'] = int(bool(tag_push)) | ||
if kwargs: | ||
data.update(kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this change the data sent over the wire from "0/1" (int) to "False/True"?
I have added the code to change the values to 0/1, I have assumed everything is a bool which seems to be case at the moment with the api. I also restored the previous param as I released it would break backwards compatibility especially as the params have different names to the gitlab API params. I also added the extra documentation to the function. |
Great. >>> int(bool("0"))
1
>>> int(bool("False"))
1
>>> int(bool("True"))
1
>>> int(bool("true"))
1
>>> int(bool(True))
1
>>> int(bool(False))
0
>>> int(bool("AnyString"))
1 I'm not sure we need to care right now. |
Yes, I had thought about putting in an isinstance to check for bools/ints but it didn't seem necessary with the current api being all bools. |
👍 |
See: https://docs.gitlab.com/ce/api/projects.html#list-project-hooks +1 for improving this API endpoint |
I particular needed access to enable_ssl_verification param but changing the code to use kwargs seemed to be more consistent with other sections of code.