Skip to content

Commit b4bba30

Browse files
authored
Accept empty resource paths in linked objects when storing (#569)
The `.store()` method contains a check that all linked objects are within the same model. However, this check falsely raised when given an empty resource path. This is now fixed by filtering out the empty resource paths in the check.
1 parent acee20f commit b4bba30

File tree

1 file changed

+3
-0
lines changed
  • src/ansys/acp/core/_tree_objects

1 file changed

+3
-0
lines changed

src/ansys/acp/core/_tree_objects/base.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,9 @@ def store(self: Self, parent: TreeObject) -> None:
306306
path_values = [collection_path.value] + [
307307
path.value for _, _, path in linked_path_fields(self._pb_object.properties)
308308
]
309+
# filter out empty paths
310+
path_values = [path for path in path_values if path]
311+
309312
# Since the path starts with 'model/<model_uuid>', the objects belong to
310313
# the same model iff they share at least the first two parts.
311314
if len(to_parts(common_path(*path_values))) < 2:

0 commit comments

Comments
 (0)