Skip to content
Snippets Groups Projects
Commit b91f936f authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

up

parent 94de0ce0
No related branches found
Tags v0.13.2
No related merge requests found
Pipeline #41093 failed
......@@ -178,6 +178,16 @@ def getCommitIn(folder):
return get_commit_in(folder)
def entity_and_id(this, that):
"""
returns true iff exactly one of this and that is an Entity with an ID and the other is an
integer
"""
return (
(isinstance(this, Entity) and this.id is not None and isinstance(that, int))
or (isinstance(this, int) and isinstance(that, Entity) and this.id is not None))
def compare_entities(old_entity: Entity, new_entity: Entity, compare_referenced_records: bool = False):
"""Compare two entites.
......@@ -279,6 +289,15 @@ def compare_entities(old_entity: Entity, new_entity: Entity, compare_referenced_
if (prop.value != matching[0].value):
# basic comparison of value objects says they are different
same_value = False
# one Entity with ID and one int?
if (sufficient_id and ):
if ((isinstance(matching[0].value, int)
and prop.value.id == matching[0].value)
or (isinstance(prop.value, int)
and prop.value == matching[0].value.id)):
same_value = True
if compare_referenced_records:
# scalar reference
if isinstance(prop.value, Entity) and isinstance(matching[0].value, Entity):
......
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