diff --git a/src/caoscrawler/identified_cache.py b/src/caoscrawler/identified_cache.py index 0b9d7a47bdecc4094edb1296f4c04dfa083a2436..19c458afaaeb447c66f3db7ea871db5d4f8833dc 100644 --- a/src/caoscrawler/identified_cache.py +++ b/src/caoscrawler/identified_cache.py @@ -47,7 +47,6 @@ def _create_hashable_string(identifiable: db.Record): raise RuntimeError("Cache entry can only be generated for entities with 1 parent.") rec_string = "P<{}>N<{}>".format(identifiable.parents[0].name, identifiable.name) for pname in sorted([p.name for p in identifiable.properties]): - value = str(identifiable.get_property(pname).value) # TODO: (for review) # This expansion of the hash function was introduced recently @@ -57,7 +56,10 @@ def _create_hashable_string(identifiable: db.Record): if isinstance(identifiable.get_property(pname).value, db.File): value = str(identifiable.get_property(pname).value.path) elif isinstance(identifiable.get_property(pname).value, db.Entity): - value = str(identifiable.get_property(pname).value.id) + if identifiable.get_property(pname).value.id is not None: + value = str(identifiable.get_property(pname).value.id) + else: + value = hex(id(identifiable.get_property(pname).value)) elif isinstance(identifiable.get_property(pname).value, list): tmplist = [] for val in identifiable.get_property(pname).value: @@ -66,6 +68,8 @@ def _create_hashable_string(identifiable: db.Record): else: tmplist.append(val) value = str(tmplist) + else: + value = str(identifiable.get_property(pname).value) rec_string += "{}:".format(pname) + value return rec_string