You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ProjectFileManager.update doesn't work as expected #340
I see that create and get are explicitly defined on ProjectFileManager, whereas update falls back to the mixin.
If I use the following method instead (hacked version of create with put instead of post), it seems to work:
def update(self, data, **kwargs):
"""Updates an existing object
Args:
data (dict): parameters to send to the server to create the
resource
**kwargs: Extra options to send to the Gitlab server (e.g. sudo)
Returns:
RESTObject: a new instance of the managed object class built with
the data sent by the server
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabCreateError: If the server cannot perform the request
"""
self._check_missing_create_attrs(data)
file_path = data.pop('file_path')
path = '%s/%s' % (self.path, file_path)
server_data = self.gitlab.http_put(path, post_data=data, **kwargs)
return self._obj_cls(self, server_data)
@mgoodhand to keep things consistent the update prototype will be update(self, file_path, new_data={}, **kwargs). file_path is not considered new data, it is the ID of the object.
Activity
gpocentek commentedon Oct 12, 2017
You're absolutely right, the
updatemethod should be redefined.gpocentek commentedon Oct 21, 2017
@mgoodhand to keep things consistent the update prototype will be
update(self, file_path, new_data={}, **kwargs).file_pathis not considered new data, it is the ID of the object.mgoodhand commentedon Oct 23, 2017
Thanks. Looks good.