From f45caa0e4c3f97c8efce0234b5bbb68e2a32f12c Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 20 Oct 2026 15:21:51 +0200 Subject: [PATCH] Fix 'ownAttrib' not always returned with 'own_attributes' - 'get_tasks' and 'get_folders' prepare fields also when default fields are used, so 'ownAttrib' is queried. - 'get_tasks_by_folder_paths' passes 'own_attributes' to 'get_tasks'. - Attribute values are queried for folders and tasks when own attributes are requested, otherwise 'ownAttrib' stayed a list of names. - 'get_project' and 'get_projects' query attributes when own attributes are requested, so the REST projects list is not used. - 'fill_own_attribs' handles empty 'attrib'. Co-Authored-By: Claude Opus 5.5 --- ayon_api/_api_helpers/folders.py | 5 +---- ayon_api/_api_helpers/projects.py | 4 ++++ ayon_api/_api_helpers/tasks.py | 4 ++-- ayon_api/server_api.py | 2 ++ ayon_api/utils.py | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ayon_api/_api_helpers/folders.py b/ayon_api/_api_helpers/folders.py index d10cfeb7a..dc0ddfce2 100644 --- a/ayon_api/_api_helpers/folders.py +++ b/ayon_api/_api_helpers/folders.py @@ -323,14 +323,11 @@ def get_folders( fields = self.get_default_fields_for_type("folder") else: fields = set(fields) - self._prepare_fields("folder", fields) + self._prepare_fields("folder", fields, own_attributes) if active is not None: fields.add("active") - if own_attributes: - fields.add("ownAttrib") - self._prepare_link_fields(fields) query = folders_graphql_query(fields) diff --git a/ayon_api/_api_helpers/projects.py b/ayon_api/_api_helpers/projects.py index df602d808..7b9174306 100644 --- a/ayon_api/_api_helpers/projects.py +++ b/ayon_api/_api_helpers/projects.py @@ -298,6 +298,8 @@ def get_projects( """ if fields is not None: fields = set(fields) + if own_attributes: + fields.add("attrib") graphql_fields, fetch_type = self._get_project_graphql_fields(fields) if fetch_type == ProjectFetchType.RESTList: @@ -358,6 +360,8 @@ def get_project( """ if fields is not None: fields = set(fields) + if own_attributes: + fields.add("attrib") graphql_fields, fetch_type = self._get_project_graphql_fields(fields) graphql_project = None diff --git a/ayon_api/_api_helpers/tasks.py b/ayon_api/_api_helpers/tasks.py index 1cae5caa5..9ab098bf7 100644 --- a/ayon_api/_api_helpers/tasks.py +++ b/ayon_api/_api_helpers/tasks.py @@ -98,7 +98,7 @@ def get_tasks( fields = self.get_default_fields_for_type("task") else: fields = set(fields) - self._prepare_fields("task", fields, own_attributes) + self._prepare_fields("task", fields, own_attributes) if active is not None: fields.add("active") @@ -253,7 +253,6 @@ def get_tasks_by_folder_paths( fields = self.get_default_fields_for_type("task") else: fields = set(fields) - self._prepare_fields("task", fields, own_attributes) fields.add("folderId") @@ -269,6 +268,7 @@ def get_tasks_by_folder_paths( active=active, filters=filters, fields=fields, + own_attributes=own_attributes, ): folder_id = task_entity["folderId"] folder_path = folder_path_by_id[folder_id] diff --git a/ayon_api/server_api.py b/ayon_api/server_api.py index 7cb03c4d4..8c6b85f64 100644 --- a/ayon_api/server_api.py +++ b/ayon_api/server_api.py @@ -2842,6 +2842,8 @@ def _prepare_fields( if entity_type == "project": add_all_attrib = True elif entity_type in {"folder", "task"}: + # Attribute values are needed to fill 'ownAttrib' + add_all_attrib = True fields.add("ownAttrib") if add_all_attrib: diff --git a/ayon_api/utils.py b/ayon_api/utils.py index f5769e7d8..714c98e6a 100644 --- a/ayon_api/utils.py +++ b/ayon_api/utils.py @@ -276,7 +276,7 @@ def fill_own_attribs(entity: AnyEntityDict) -> None: entity (dict): Entity dictionary. """ - if not entity or not entity.get("attrib"): + if not entity or entity.get("attrib") is None: return attributes = entity.get("ownAttrib")