Skip to content
Snippets Groups Projects
Commit 65ca9fba authored by I. Nüske's avatar I. Nüske
Browse files

MNT: Use new Entity getters

parent fa86a04e
No related branches found
No related tags found
2 merge requests!128MNT: Added a warning when column metadata is not configured, and a better...,!126Fix pylint errors
......@@ -296,7 +296,7 @@ class DataModel(dict):
if parent.name in visited_parents:
continue
visited_parents.add(parent.name)
parent_importance = importances.get(parent._flags.get("inheritance"), 999)
parent_importance = importances.get(parent.flags.get("inheritance"), 999)
if parent.name in self:
deep_parent = self.get_deep(parent.name, # visited_props=visited_props,
visited_parents=visited_parents
......
......@@ -43,10 +43,9 @@ class EntityMapping(object):
self.to_target = {}
def add(self, target, existing):
if target._cuid is None:
target._cuid = str(uuid())
self.to_existing[str(target._cuid)] = existing
if target.cuid is None:
target._cuid = str(uuid()) # pylint: disable=protected-access
self.to_existing[str(target.cuid)] = existing
self.to_target[existing.id] = target
......@@ -108,11 +107,11 @@ def update_structure(em, updating: db.Container, target_structure: db.Record):
A record which may have references to other records. Must be a DAG.
"""
if target_structure._cuid in em.to_existing:
if target_structure.cuid in em.to_existing:
update_matched_entity(em,
updating,
target_structure,
em.to_existing[target_structure._cuid])
em.to_existing[target_structure.cuid])
for prop in target_structure.get_properties():
if prop.is_reference(server_retrieval=True):
......@@ -139,8 +138,8 @@ def update_matched_entity(em, updating, target_record, existing_record):
# check for remaining property types
if isinstance(prop.value, db.Entity):
if prop.value._cuid in em.to_existing:
value = em.to_existing[prop.value._cuid].id
if prop.value.cuid in em.to_existing:
value = em.to_existing[prop.value.cuid].id
else:
value = prop.value.id
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment