Skip to content
Snippets Groups Projects
Commit 2cf581f7 authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

ENH: added correct formatting of sub properties in identifiables cache

parent 23ee5eed
No related branches found
No related tags found
No related merge requests found
Pipeline #24790 failed
......@@ -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):
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment