Skip to content
Snippets Groups Projects
Commit 13b26965 authored by Cyril Moineau's avatar Cyril Moineau
Browse files

Update ExportLib.get_export_node to check if only one node is avaialbe and not...

Update ExportLib.get_export_node to check if only one node is avaialbe and not if only one node is registered.
parent 3db69a1f
No related branches found
No related tags found
No related merge requests found
......@@ -83,14 +83,21 @@ class ExportLib(ABC):
:return: Corresponding export node.
:rtype: ExportNode
"""
if not cls.exportable(node):
export_nodes_available = []
if node.type() not in cls._export_node_registry:
raise ValueError(
f"Node {node.type()} is not exportable by ExportLib {cls.name} !")
if len(cls._export_node_registry[node.type()]) != 1:
f"Node {node.type()} is not exportable by ExportLib {cls.name}.")
else:
for i in cls._export_node_registry[node.type()]:
if i.exportable(node):
export_nodes_available.append(i)
if len(export_nodes_available) == 0:
raise RuntimeError(f"Node {node.name()}[{node.type()}] is not exportable with ExportLib {cls.name}.")
elif len(export_nodes_available) != 1:
raise RuntimeError(
"ExportLib registry doesn't support when multiple export node are available yet ...")
f"ExportLib registry doesn't yet support when multiple export node are available.\nExport failed for node of type {node.type()}.")
else:
return cls._export_node_registry[node.type()][0]
return export_nodes_available[0]
@classmethod
def add_export_node(cls, key: str, eNode: ExportNode) -> None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment