Skip to content
Snippets Groups Projects

F delete container

Merged Henrik tom Wörden requested to merge f-delete-container into dev
2 files
+ 22
9
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -2880,8 +2880,10 @@ class Container(list):
"""
item_id = set()
is_parent = set()
has_references = set()
is_property = set()
is_being_referenced = set()
dependent_parents = set()
dependent_properties = set()
dependent_references = set()
dependencies = set()
@@ -2896,26 +2898,31 @@ class Container(list):
# add only if it is a reference, not a property
if isinstance(references.value, int):
has_references.add(references.value)
is_being_referenced.add(references.value)
elif is_list_datatype(references.datatype):
for list_item in references.value:
if isinstance(list_item, int):
has_references.add(list_item)
is_being_referenced.add(list_item)
else:
has_references.add(list_item.id)
is_being_referenced.add(list_item.id)
else:
try:
has_references.add(references.value.id)
is_being_referenced.add(references.value.id)
except:
pass
if hasattr(references, 'id'):
is_property.add(references.id)
dependent_parents = item_id.intersection(is_parent)
dependent_references = item_id.intersection(has_references)
dependent_properties = item_id.intersection(is_property)
dependent_references = item_id.intersection(is_being_referenced)
dependencies = dependent_parents.union(dependent_references)
dependencies = dependencies.union(dependent_properties)
return dependencies
def delete(self, raise_exception_on_error=True, flags=None):
def delete(self, raise_exception_on_error=True, flags=None, chunk_size=100):
"""Delete all entities in this container.
Entities are identified via their id if present and via their
@@ -2926,7 +2933,6 @@ class Container(list):
this happens, none of them will be deleted. It occurs an error
instead.
"""
chunk_size = 100
item_count = len(self)
# Split Container in 'chunk_size'-sized containers (if necessary) to avoid error 414 Request-URI Too Long
Loading