diff --git a/src/caosdb/common/models.py b/src/caosdb/common/models.py index 1a600e05bbda957429931f5886e04ace32f025be..ac9321bbd2384694d6606460d150ef2a64e68b38 100644 --- a/src/caosdb/common/models.py +++ b/src/caosdb/common/models.py @@ -1408,6 +1408,7 @@ class File(Record): if from_location is not None: warn(DeprecationWarning( "Param `from_location` is deprecated, use `pickup instead`.")) + if self.pickup is None: self.pickup = from_location @@ -1617,6 +1618,7 @@ class _Properties(list): if isinstance(prop, Entity): if prop in self: list.remove(self, prop) + return else: if prop.id is not None: @@ -2483,7 +2485,9 @@ class Container(list): sync_remote_entities = [] for remote_entity in remote_container: - if remote_entity.id is not None and remote_entity.id == local_entity.id and remote_entity not in used_remote_entities: + if (remote_entity.id is not None + and remote_entity.id == local_entity.id + and remote_entity not in used_remote_entities): sync_remote_entities.append(remote_entity) used_remote_entities.append(remote_entity) @@ -2502,14 +2506,18 @@ class Container(list): ''' match by path ''' for local_entity in self: - if sync_dict[local_entity] is None and local_entity.path is not None: + if (sync_dict[local_entity] is None + and local_entity.path is not None): sync_remote_entities = [] for remote_entity in remote_container: - if remote_entity.path is not None and str( - remote_entity.path) == ( - local_entity.path if local_entity.path.startswith("/") else "/" + - local_entity.path) and remote_entity not in used_remote_entities: + if (remote_entity.path is not None + and str(remote_entity.path) == ( + local_entity.path + + if local_entity.path.startswith("/") else "/" + + local_entity.path) + and remote_entity not in used_remote_entities): sync_remote_entities.append(remote_entity) used_remote_entities.append(remote_entity) @@ -2528,7 +2536,8 @@ class Container(list): ''' match by name ''' for local_entity in self: - if sync_dict[local_entity] is None and local_entity.name is not None: + if (sync_dict[local_entity] is None + and local_entity.name is not None): sync_remote_entities = [] for remote_entity in remote_container: @@ -2538,7 +2547,7 @@ class Container(list): (name_case_sensitive is False and str(remote_entity.name).lower() == str( local_entity.name).lower())) - and remote_entity not in used_remote_entities): + and remote_entity not in used_remote_entities): sync_remote_entities.append(remote_entity) used_remote_entities.append(remote_entity)