diff --git a/src/caosadvancedtools/cfood.py b/src/caosadvancedtools/cfood.py index 1310919d37c0194f32fef44edc6f9b9baf02395f..94eada6f044c5cce6b5923c38f38f59d8800ce85 100644 --- a/src/caosadvancedtools/cfood.py +++ b/src/caosadvancedtools/cfood.py @@ -280,7 +280,8 @@ def assure_object_is_in_list(obj, containing_object, property_name, to_be_updated.append(containing_object) -def assure_has_parent(entity, parent, to_be_updated=None, verbosity=INFO): +def assure_has_parent(entity, parent, to_be_updated=None, verbosity=INFO, + force=False): """ Checks whether `entity` has a parent with name `parent`. @@ -314,7 +315,13 @@ def assure_has_parent(entity, parent, to_be_updated=None, verbosity=INFO): if to_be_updated is None: get_ids_for_entities_with_names([entity]) - guard.safe_update(entity, unique=False) + # TODO move the unique argument? + # TODO find a better way then force? + + if force: + entity.update(unique=False) + else: + guard.safe_update(entity, unique=False) else: to_be_updated.append(entity)