-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from Syncano/LIB-637
[LIB-637] add rename mixin for the rename functionality, add this t…
- Loading branch information
Showing
4 changed files
with
40 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
|
||
class RenameMixin(object): | ||
|
||
def rename(self, new_name): | ||
""" | ||
A method for changing the name of the object; Corresponds to the Mixin in CORE; | ||
:param new_name: the new name for the object; | ||
:return: a populated object; | ||
""" | ||
rename_path = self.links.rename | ||
data = {'new_name': new_name} | ||
connection = self._get_connection() | ||
response = connection.request('POST', rename_path, data=data) | ||
self.to_python(response) | ||
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters