Skip to content

Commit

Permalink
ORM: Check nodes are from same backend in validate_link (#5462)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Jul 11, 2023
1 parent fd4c126 commit 7bd546e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aiida/orm/utils/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ def validate_link(
type_check(source, Node, f'source should be a `Node` but got: {type(source)}')
type_check(target, Node, f'target should be a `Node` but got: {type(target)}')

if source.backend != target.backend:
raise ValueError(
f'source and target nodes must be stored in the same backend, but got {source.backend} and {target.backend}'
)

if source.uuid is None or target.uuid is None:
raise ValueError('source or target node does not have a UUID')

Expand Down

0 comments on commit 7bd546e

Please sign in to comment.