mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Check that source folder type could be pushed to destination
This commit is contained in:
parent
062f756413
commit
475d4800a2
1 changed files with 24 additions and 2 deletions
|
|
@ -702,7 +702,11 @@ class ProjectPushItemProcess:
|
|||
if new_folder_name != folder_name:
|
||||
folder_label = folder_name
|
||||
|
||||
# TODO find out how to define folder type
|
||||
src_folder_type = src_folder_entity["folderType"]
|
||||
self._check_src_folder_type(
|
||||
project_entity,
|
||||
src_folder_type
|
||||
)
|
||||
folder_entity = new_folder_entity(
|
||||
folder_name,
|
||||
"Folder",
|
||||
|
|
@ -727,6 +731,24 @@ class ProjectPushItemProcess:
|
|||
folder_entity["path"] = "/".join([parent_path, folder_name])
|
||||
return folder_entity
|
||||
|
||||
def _check_src_folder_type(
|
||||
self,
|
||||
project_entity: Dict[str, Any],
|
||||
src_folder_type: str
|
||||
):
|
||||
"""Confirm that folder type exists in destination project"""
|
||||
folder_types = [
|
||||
folder_type["name"].lower()
|
||||
for folder_type in project_entity["folderTypes"]
|
||||
]
|
||||
|
||||
if src_folder_type.lower() not in folder_types:
|
||||
self._status.set_failed(
|
||||
f"'{src_folder_type}' folder type is not configured in "
|
||||
f"project Anatomy."
|
||||
)
|
||||
raise PushToProjectError(self._status.fail_reason)
|
||||
|
||||
def _fill_or_create_destination_folder(self):
|
||||
dst_project_name = self._item.dst_project_name
|
||||
dst_folder_id = self._item.dst_folder_id
|
||||
|
|
@ -1205,7 +1227,7 @@ class ProjectPushItemProcess:
|
|||
value_to_update = formatting_data.get(context_key)
|
||||
if value_to_update:
|
||||
repre_context[context_key] = value_to_update
|
||||
if "task" not in formatting_data:
|
||||
if "task" not in formatting_data and "task" in repre_context:
|
||||
repre_context.pop("task")
|
||||
return repre_context
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue