Commit 232d4961 authored by Merret Buurman's avatar Merret Buurman
Browse files

Catch error if child handle record cannot be retrieved.

parent a712e35e
...@@ -303,10 +303,22 @@ def _get_list_of_parts_records_from_record(record): ...@@ -303,10 +303,22 @@ def _get_list_of_parts_records_from_record(record):
list_to_be_returned = [] list_to_be_returned = []
any_replaced = False any_replaced = False
for handle in list_of_parts_handles: for handle in list_of_parts_handles:
info, replaced = _extract_info_on_one_part_record(handle) try:
list_to_be_returned.append(info) info, replaced = _extract_info_on_one_part_record(handle)
if replaced: list_to_be_returned.append(info)
any_replaced = True if replaced:
any_replaced = True
except ValueError:
# If we cannot access the child record, do not
# append anything, just leave this one out.
# If no child handle record could be retrieved, but there is children,
# return None to show that something went wrong.
if len(list_to_be_returned) == 0 and len(list_of_parts_handles) > 0:
list_to_be_returned = None
any_replaced = None
return list_to_be_returned, any_replaced return list_to_be_returned, any_replaced
def _extract_info_on_one_part_record(handle): def _extract_info_on_one_part_record(handle):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment