Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions 11 gitlab/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,30 +525,33 @@ def _get_updated_data(self) -> Dict[str, Any]:

return updated_data

def save(self, **kwargs: Any) -> None:
def save(self, **kwargs: Any) -> Optional[Dict[str, Any]]:
"""Save the changes made to the object to the server.

The object is updated to match what the server returns.

Args:
**kwargs: Extra options to send to the server (e.g. sudo)

Returns:
The new object data (*not* a RESTObject)

Raise:
GitlabAuthenticationError: If authentication is not correct
GitlabUpdateError: If the server cannot perform the request
"""
updated_data = self._get_updated_data()
# Nothing to update. Server fails if sent an empty dict.
if not updated_data:
return
return None

# call the manager
obj_id = self.encoded_id
if TYPE_CHECKING:
assert isinstance(self.manager, UpdateMixin)
server_data = self.manager.update(obj_id, updated_data, **kwargs)
if server_data is not None:
self._update_attrs(server_data)
self._update_attrs(server_data)
return server_data


class ObjectDeleteMixin(_RestObjectBase):
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.