8000 fix: allow updating of sub-pages in wikis · python-gitlab/python-gitlab@211d461 · GitHub
[go: up one dir, main page]

Skip to content

Commit 211d461

Browse files
kernelportJohnVillalovos
authored andcommitted
fix: allow updating of sub-pages in wikis
Make it possible to update subpages in wikis Update SaveMixin to use utils._url_encode() on the ID if it is a string. Closes: #1079
1 parent ac81272 commit 211d461

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gitlab/mixins.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ def _get_updated_data(self) -> Dict[str, Any]:
527527

528528
return updated_data
529529

530-
def save(self, **kwargs: Any) -> None:
530+
def save(self, **kwargs: Any) -> Optional[Dict[str, Any]]:
531531
"""Save the changes made to the object to the server.
532532
533533
The object is updated to match what the server returns.
@@ -542,15 +542,18 @@ def save(self, **kwargs: Any) -> None:
542542
updated_data = self._get_updated_data()
543543
# Nothing to update. Server fails if sent an empty dict.
544544
if not updated_data:
545-
return
545+
return None
546546

547547
# call the manager
548548
obj_id = self.get_id()
549549
if TYPE_CHECKING:
550550
assert isinstance(self.manager, UpdateMixin)
551+
if isinstance(obj_id, str):
552+
obj_id = utils._url_encode(obj_id)
551553
server_data = self.manager.update(obj_id, updated_data, **kwargs)
552554
if server_data is not None:
553555
self._update_attrs(server_data)
556+
return server_data
554557

555558

556559
class ObjectDeleteMixin(_RestObjectBase):

0 commit comments

Comments
 (0)
0