Skip to content

Commit bb748c2

Browse files
Nebukadnezaoroulet
authored andcommitted
Also treat OptionalPlaceholder ModellingRule as optional in instantiate
`instantiate` with `instantiate_optional=False` would also instantiate children that have the ModellingRule OptionalPlaceholder. So far, only Optional children were ignored. This commit fixes this behavior, and treats both of them the same w.r.t. `instantiate_optional`. Fixes #1092
1 parent 3990a96 commit bb748c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

opcua/common/instantiate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def _instantiate_node(server,
100100
logger.info("Instantiate: Skip node without modelling rule %s as part of %s", c_rdesc.BrowseName, addnode.BrowseName)
101101
continue
102102
# exclude nodes with optional ModellingRule if requested
103-
if not instantiate_optional and refs[0].nodeid == ua.NodeId(ua.ObjectIds.ModellingRule_Optional):
103+
if not instantiate_optional and refs[0].nodeid in (ua.NodeId(ua.ObjectIds.ModellingRule_Optional), ua.NodeId(ua.ObjectIds.ModellingRule_OptionalPlaceholder)):
104104
logger.info("Instantiate: Skip optional node %s as part of %s", c_rdesc.BrowseName, addnode.BrowseName)
105105
continue
106106

0 commit comments

Comments
 (0)