Skip to content
Snippets Groups Projects
Commit 7aa7832c authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

force

parent bbd6a022
Branches
Tags
No related merge requests found
......@@ -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,6 +315,12 @@ 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])
# 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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment