diff --git a/src/linkahead/apiutils.py b/src/linkahead/apiutils.py index 0c023e3a712465e29d4909f23999badb3eb65a14..d654905489e67b497abfae293b8eaca10f2f4d18 100644 --- a/src/linkahead/apiutils.py +++ b/src/linkahead/apiutils.py @@ -248,6 +248,21 @@ def compare_entities(old_entity: Entity, if old_entity_attr_na and new_entity_attr_na: continue + # treat datatype separately: if datatype is an object on one side and string on the other. + if attr == "datatype": + if (not old_entity_attr_na and not new_entity_attr_na): + if isinstance(oldattr, RecordType): + if oldattr.name == newattr: + continue + if oldattr.id == newattr: + continue + if isinstance(newattr, RecordType): + if newattr.name == oldattr: + continue + if newattr.id == oldattr: + continue + + # only one set or different values if ((old_entity_attr_na ^ new_entity_attr_na) or (oldattr != newattr)): @@ -257,6 +272,7 @@ def compare_entities(old_entity: Entity, if not new_entity_attr_na: newdiff[attr] = newattr + # value if (old_entity.value != new_entity.value): # basic comparison of value objects says they are different