mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Ignore invalid uuids in query to AYON API
This commit is contained in:
parent
6cfa9a1646
commit
0a2a1105df
1 changed files with 18 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import uuid
|
||||
from collections import defaultdict
|
||||
import pyblish.api
|
||||
|
||||
|
|
@ -8,6 +9,15 @@ from ayon_core.pipeline.publish import (
|
|||
from ayon_api import get_folders
|
||||
|
||||
|
||||
def is_valid_uuid(value) -> bool:
|
||||
"""Return whether value is a valid UUID"""
|
||||
try:
|
||||
uuid.UUID(value)
|
||||
except ValueError:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class ValidateNodeIDsRelated(pyblish.api.InstancePlugin,
|
||||
OptionalPyblishPluginMixin):
|
||||
"""Validate nodes have a related Colorbleed Id to the
|
||||
|
|
@ -70,6 +80,14 @@ class ValidateNodeIDsRelated(pyblish.api.InstancePlugin,
|
|||
if nodes_by_other_folder_ids:
|
||||
project_name = instance.context.data["projectName"]
|
||||
other_folder_ids = set(nodes_by_other_folder_ids.keys())
|
||||
|
||||
# Remove folder ids that are not valid UUID identifiers, these
|
||||
# may be legacy OpenPype ids
|
||||
other_folder_ids = {folder_id for folder_id in other_folder_ids
|
||||
if is_valid_uuid(folder_id)}
|
||||
if not other_folder_ids:
|
||||
return invalid
|
||||
|
||||
folder_entities = get_folders(project_name=project_name,
|
||||
folder_ids=other_folder_ids,
|
||||
fields=["path"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue