Skip to content

Commit

Permalink
implemented name setter
Browse files Browse the repository at this point in the history
  • Loading branch information
iLLiCiTiT committed Nov 26, 2024
1 parent 7df8b37 commit 8291ce2
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions ayon_api/entity_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -1775,14 +1775,6 @@ def lock(self):
def _get_entity_by_id(self, entity_id):
return self._entity_hub.get_entity_by_id(entity_id)

def get_name(self):
return self._name

def set_name(self, name):
self._name = name

name = property(get_name, set_name)

def get_parent_id(self):
"""Parent entity id.
Expand Down Expand Up @@ -1972,7 +1964,17 @@ def get_name(self):
)
return self._name

name = property(get_name)
def set_name(self, name):
if not self._supports_name:
raise NotImplementedError(
f"Name is not supported for '{self.entity_type}'."
)

if not isinstance(name, str):
raise TypeError("Name must be a string.")
self._name = name

name = property(get_name, set_name)

def get_label(self) -> Optional[str]:
if not self._supports_label:
Expand Down

0 comments on commit 8291ce2

Please sign in to comment.