Commit cd854bdb authored by Merret Buurman's avatar Merret Buurman
Browse files

Remove the hdl: in fields parsed from handle records.

parent 605bf065
...@@ -177,7 +177,13 @@ def _parse_urls_replicas_from_record(field_string): ...@@ -177,7 +177,13 @@ def _parse_urls_replicas_from_record(field_string):
def _get_list_of_aggregation_handles_from_record(record): def _get_list_of_aggregation_handles_from_record(record):
field_string = get_aggregation_field_from_record(record) field_string = get_aggregation_field_from_record(record)
return field_string.split(';') list_of_strings = field_string.split(';')
handles = []
for member in list_of_strings:
handles.append(_remove_hdl_from_handle(member))
return handles
# Retrieve info on parent dataset from handle system:
def _get_list_of_aggregation_records_from_record(record): def _get_list_of_aggregation_records_from_record(record):
list_of_aggregation_handles = get_list_of_aggregation_handles_from_record(record) list_of_aggregation_handles = get_list_of_aggregation_handles_from_record(record)
...@@ -247,7 +253,9 @@ def _get_version_number_from_record(record): ...@@ -247,7 +253,9 @@ def _get_version_number_from_record(record):
return get_value_from_record(record, 'VERSION_NUMBER') return get_value_from_record(record, 'VERSION_NUMBER')
def _get_replaced_by_from_record(record): def _get_replaced_by_from_record(record):
return get_value_from_record(record, 'REPLACED_BY') value = get_value_from_record(record, 'REPLACED_BY')
handle = _remove_hdl_from_handle(value)
return handle
def _get_hosts_original_from_record(record): def _get_hosts_original_from_record(record):
field_string = get_value_from_record(record, 'HOSTING_NODE') field_string = get_value_from_record(record, 'HOSTING_NODE')
...@@ -261,7 +269,11 @@ def _get_hosts_replicas_from_record(record): ...@@ -261,7 +269,11 @@ def _get_hosts_replicas_from_record(record):
def _get_list_of_parts_handles_from_record(record): def _get_list_of_parts_handles_from_record(record):
field_string = _get_parts_field_from_record(record) field_string = _get_parts_field_from_record(record)
return field_string.split(';') list_of_strings = field_string.split(';')
handles = []
for string in list_of_strings:
handles.append(_remove_hdl_from_handle(string))
return handles
def _get_list_of_parts_records_from_record(record): def _get_list_of_parts_records_from_record(record):
list_of_parts_handles = _get_list_of_parts_handles_from_record(record) list_of_parts_handles = _get_list_of_parts_handles_from_record(record)
...@@ -343,4 +355,14 @@ def _get_all_entries_as_dict(record, include_special_types=True): ...@@ -343,4 +355,14 @@ def _get_all_entries_as_dict(record, include_special_types=True):
pass pass
else: else:
record_dict[key] = str(get_value_from_record(record, key)) record_dict[key] = str(get_value_from_record(record, key))
return record_dict return record_dict
\ No newline at end of file
# Helper
def _remove_hdl_from_handle(handle):
if handle is not None:
if handle.startswith('hdl:'):
return handle.replace('hdl:','')
else:
return 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