@@ -530,7 +530,7 @@ class ApplicationSettingsManager(GetWithoutIdMixin, UpdateMixin, RESTManager):
530
530
)
531
531
532
532
@exc .on_http_error (exc .GitlabUpdateError )
533
- def update (self , id = None , new_data = {} , ** kwargs ):
533
+ def update (self , id = None , new_data = None , ** kwargs ):
534
534
"""Update an object on the server.
535
535
536
536
Args:
@@ -545,7 +545,7 @@ def update(self, id=None, new_data={}, **kwargs):
545
545
GitlabAuthenticationError: If authentication is not correct
546
546
GitlabUpdateError: If the server cannot perform the request
547
547
"""
548
-
548
+ new_data = new_data or {}
549
549
data = new_data .copy ()
550
550
if "domain_whitelist" in data and data ["domain_whitelist" ] is None :
551
551
data .pop ("domain_whitelist" )
@@ -865,13 +865,14 @@ class GroupLabelManager(ListMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTMa
865
865
_update_attrs = (("name" ,), ("new_name" , "color" , "description" , "priority" ))
866
866
867
867
# Update without ID.
868
- def update (self , name , new_data = {} , ** kwargs ):
868
+ def update (self , name , new_data = None , ** kwargs ):
869
869
"""Update a Label on the server.
870
870
871
871
Args:
872
872
name: The name of the label
873
873
**kwargs: Extra options to send to the server (e.g. sudo)
874
874
"""
875
+ new_data = new_data or {}
875
876
new_data ["name" ] = name
876
877
super ().update (id = None , new_data = new_data , ** kwargs )
877
878
@@ -2994,13 +2995,14 @@ class ProjectLabelManager(
2994
2995
_update_attrs = (("name" ,), ("new_name" , "color" , "description" , "priority" ))
2995
2996
2996
2997
# Update without ID.
2997
- def update (self , name , new_data = {} , ** kwargs ):
2998
+ def update (self , name , new_data = None , ** kwargs ):
2998
2999
"""Update a Label on the server.
2999
3000
3000
3001
Args:
3001
3002
name: The name of the label
3002
3003
**kwargs: Extra options to send to the server (e.g. sudo)
3003
3004
"""
3005
+ new_data = new_data or {}
3004
3006
new_data ["name" ] = name
3005
3007
super ().update (id = None , new_data = new_data , ** kwargs )
3006
3008
@@ -3130,7 +3132,7 @@ def create(self, data, **kwargs):
3130
3132
return self ._obj_cls (self , server_data )
3131
3133
3132
3134
@exc .on_http_error (exc .GitlabUpdateError )
3133
- def update (self , file_path , new_data = {} , ** kwargs ):
3135
+ def update (self , file_path , new_data = None , ** kwargs ):
3134
3136
"""Update an object on the server.
3135
3137
3136
3138
Args:
@@ -3145,7 +3147,7 @@ def update(self, file_path, new_data={}, **kwargs):
3145
3147
GitlabAuthenticationError: If authentication is not correct
3146
3148
GitlabUpdateError: If the server cannot perform the request
3147
3149
"""
3148
-
3150
+ new_data = new_data or {}
3149
3151
data = new_data .copy ()
3150
3152
file_path = file_path .replace ("/" , "%2F" )
3151
3153
data ["file_path" ] = file_path
@@ -3632,7 +3634,7 @@ def get(self, id, **kwargs):
3632
3634
obj .id = id
3633
3635
return obj
3634
3636
3635
- def update (self , id = None , new_data = {} , ** kwargs ):
3637
+ def update (self , id = None , new_data = None , ** kwargs ):
3636
3638
"""Update an object on the server.
3637
3639
3638
3640
Args:
@@ -3647,6 +3649,7 @@ def update(self, id=None, new_data={}, **kwargs):
3647
3649
GitlabAuthenticationError: If authentication is not correct
3648
3650
GitlabUpdateError: If the server cannot perform the request
3649
3651
"""
3652
+ new_data = new_data or {}
3650
3653
super (ProjectServiceManager , self ).update (id , new_data , ** kwargs )
3651
3654
self .id = id
3652
3655
@@ -4182,7 +4185,7 @@ def unshare(self, group_id, **kwargs):
4182
4185
# variables not supported in CLI
4183
4186
@cli .register_custom_action ("Project" , ("ref" , "token" ))
4184
4187
@exc .on_http_error (exc .GitlabCreateError )
4185
- def trigger_pipeline (self , ref , token , variables = {} , ** kwargs ):
4188
+ def trigger_pipeline (self , ref , token , variables = None , ** kwargs ):
4186
4189
"""Trigger a CI build.
4187
4190
4188
4191
See https://gitlab.com/help/ci/triggers/README.md#trigger-a-build
@@ -4197,6 +4200,7 @@ def trigger_pipeline(self, ref, token, variables={}, **kwargs):
4197
4200
GitlabAuthenticationError: If authentication is not correct
4198
4201
GitlabCreateError: If the server failed to perform the request
4199
4202
"""
4203
+ variables = variables or {}
4200
4204
path = "/projects/%s/trigger/pipeline" % self .get_id ()
4201
4205
post_data = {"ref" : ref , "token" : token , "variables" : variables }
4202
4206
attrs = self .manager .gitlab .http_post (path , post_data = post_data , ** kwargs )
0 commit comments