Skip to content
Snippets Groups Projects
Commit 76184d95 authored by florian's avatar florian
Browse files

DRAFT: Implement possible fix for missing list datatype

parent f1797a49
No related branches found
No related tags found
2 merge requests!93Release 0.11.0,!92F merge missing list datatype
Pipeline #32556 failed
......@@ -37,7 +37,7 @@ from subprocess import call
from typing import Optional, Any, Dict, List
from caosdb.common.datatype import (BOOLEAN, DATETIME, DOUBLE, FILE, INTEGER,
REFERENCE, TEXT, is_reference)
LIST, REFERENCE, TEXT, is_reference)
from caosdb.common.models import (Container, Entity, File, Property, Query,
Record, RecordType, execute_query,
get_config, SPECIAL_ATTRIBUTES)
......@@ -442,6 +442,16 @@ def merge_entities(entity_a: Entity, entity_b: Entity, merge_references_with_emp
setattr(entity_a.get_property(key), attribute,
diff_r2["properties"][key][attribute])
elif force:
if attribute == "value":
# Very special case of a property that has a scalar
# datatype being fored to a list value without
# having been assigned the correct datatype before.
if isinstance(diff_r2["properties"][key][attribute], list):
if ((entity_a.get_property(key).datatype is not None) and
(not entity_a.get_property(key).datatype.startswith("LIST<"))):
entity_a.get_property(key).datatype = LIST(
entity_a.get_property(key).datatype)
setattr(entity_a.get_property(key), attribute,
diff_r2["properties"][key][attribute])
else:
......
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