Commit 19932ff2 authored by Merret Buurman's avatar Merret Buurman
Browse files

If records are not found, make sure handles are displayed anyways.

parent f62ed588
......@@ -221,46 +221,46 @@ def _get_list_of_aggregation_records_from_record(list_of_aggregation_handles):
any_replaced = False
for handle in list_of_aggregation_handles:
try:
info, replaced = _extract_info_on_one_aggregation_record(handle)
list_to_be_returned.append(info)
if replaced:
any_replaced = True
except ValueError:
# If we cannot access the parent record, do not
# append anything, just leave this one out.
pass
# If no parent handle record could be retrieved, but there is parents,
# return None to show that something went wrong.
if len(list_to_be_returned) == 0 and len(list_of_aggregation_handles) > 0:
list_to_be_returned = None
any_replaced = None
info, replaced = _extract_info_on_one_aggregation_record(handle)
list_to_be_returned.append(info)
if replaced:
any_replaced = True
return list_to_be_returned, any_replaced
def _extract_info_on_one_aggregation_record(parenthandle):
# Retrieve handle:
record = retrieval.get_handle_record_json(parenthandle)
# Get info:
aggregation_level = get_aggregation_level(record)
drs_id = get_drs_name_from_record(record)
vers_num = get_version_number_from_record(record)
newer_version = get_replaced_by_from_record(record)
replaced = False
if newer_version is not None and not newer_version == parenthandle:
replaced = True
# Assemble info:
info_to_return = dict(
handle = parenthandle,
level = aggregation_level.lower(),
title = drs_id,
version = vers_num,
replaced = newer_version
)
try:
record = retrieval.get_handle_record_json(parenthandle)
# Get info:
aggregation_level = get_aggregation_level(record)
drs_id = get_drs_name_from_record(record)
vers_num = get_version_number_from_record(record)
newer_version = get_replaced_by_from_record(record)
replaced = False
if newer_version is not None and not newer_version == parenthandle:
replaced = True
# Assemble info:
info_to_return = dict(
handle = parenthandle,
level = aggregation_level.lower(),
title = drs_id,
version = vers_num,
replaced = newer_version
)
except ValueError:
info_to_return = dict(
handle = parenthandle,
level = 'unknown',
title = 'title unknown',
version = 'unknown',
replaced = 'unknown'
)
replaced = False # We don't know, but need to put somethine here...
return info_to_return, replaced
###
......@@ -314,47 +314,45 @@ def _get_list_of_parts_records_from_record(record):
list_to_be_returned = []
any_replaced = False
for handle in list_of_parts_handles:
try:
info, replaced = _extract_info_on_one_part_record(handle)
list_to_be_returned.append(info)
if replaced:
any_replaced = True
except ValueError:
# If we cannot access the child record, do not
# append anything, just leave this one out.
pass
# 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
info, replaced = _extract_info_on_one_part_record(handle)
list_to_be_returned.append(info)
if replaced:
any_replaced = True
return list_to_be_returned, any_replaced
def _extract_info_on_one_part_record(handle):
# Retrieve handle:
record = retrieval.get_handle_record_json(handle)
# Get info:
aggregation_level = get_aggregation_level(record)
title = get_title_from_record(record)
vers_num = get_version_number_from_record(record)
newer_version = get_replaced_by_from_record(record)
replaced = False
if newer_version is not None and not newer_version == handle:
replaced = True
# Assemble info:
info_to_return = dict(
handle = handle,
level = aggregation_level.lower(),
title = title,
replaced = replaced
)
if vers_num is not None:
info_to_return['version'] = vers_num
try:
record = retrieval.get_handle_record_json(handle)
# Get info:
aggregation_level = get_aggregation_level(record)
title = get_title_from_record(record)
vers_num = get_version_number_from_record(record)
newer_version = get_replaced_by_from_record(record)
replaced = False
if newer_version is not None and not newer_version == handle:
replaced = True
# Assemble info:
info_to_return = dict(
handle = handle,
level = aggregation_level.lower(),
title = title,
replaced = replaced
)
if vers_num is not None:
info_to_return['version'] = vers_num
except ValueError:
info_to_return = dict(
handle = handle,
level = 'unknown',
title = 'title unknown',
replaced = False
)
return info_to_return, replaced
......
Markdown is supported
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