Skip to content

Commit c492e35

Browse files
XB32Zoroulet
authored andcommitted
Updated instanciate.py to handle DataType Nodes (FreeOpcUa#473)
* Updated instanciate.py to handle DataType Nodes Hi, I had a bug creating an instance of a Type I imported via XML. Some Nodes where of NodeClass DataType which would trigger the warning l70 then crash l 93 because the object returned was None. I hope that my fix is ok with the specification. Thx * Update instantiate.py updated commit to fit requirements
1 parent fdd80be commit c492e35

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

opcua/common/instantiate.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,12 @@ def _instantiate_node(server, parentid, rdesc, nodeid, bname, dname=None, recurs
6363
elif rdesc.NodeClass in (ua.NodeClass.Method,):
6464
addnode.NodeClass = ua.NodeClass.Method
6565
_read_and_copy_attrs(node_type, ua.MethodAttributes(), addnode)
66+
elif rdesc.NodeClass in (ua.NodeClass.DataType,):
67+
addnode.NodeClass = ua.NodeClass.DataType
68+
_read_and_copy_attrs(node_type, ua.DataTypeAttributes(), addnode)
6669
else:
67-
logger.warning("Instantiate: Node class not supported: %s", rdesc.NodeClass)
70+
logger.error("Instantiate: Node class not supported: %s", rdesc.NodeClass)
71+
raise RuntimeError("Instantiate: Node class not supported")
6872
return
6973
if dname is not None:
7074
addnode.NodeAttributes.DisplayName = dname

0 commit comments

Comments
 (0)