You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If one publication is defined, the main parsing loop will produce a dict. Subsequent code expects a list, and would iterate over a dictionary instead.
When an author is provided with only a name (only mandatory), and no subsequent columns, it will be parsed as a string. Subsequent code expects a dict, and would try to get by key.
This is a simple patch that deals with this cases "downstream", but maybe it would be better to change the main parsing loop.
diff --git a/bin/tubby2catalog b/bin/tubby2catalog
index e8488d5..84d3cc5 100755
--- a/bin/tubby2catalog+++ b/bin/tubby2catalog@@ -212,10 +212,15 @@ def map_to_catalog(metadata, config):
elif key == 'publications':
if key not in meta_item.keys():
meta_item[key] = []
- for pub in metadata[key]:- meta_item[key].append(- get_publication(pub)- )+ if isinstance(metadata[key], dict):+ # only a single item was found, do not iterate+ pub = metadata[key]+ meta_item[key].append(get_publication(pub))+ else:+ for pub in metadata[key]:+ meta_item[key].append(+ get_publication(pub)+ )
else:
meta_item[key] = metadata[key]
@@ -250,9 +255,16 @@ def get_dataset_version(input):
def get_author(author):
- full_name = author.get('full_name', None)- email = author.get('email', None)- orcid = author.get('orcid', None)+ if isinstance(author, str):+ # single-values are not mapped into dictionaries+ # putting more tabs doesn't help because rstrip strips them all+ full_name = author+ email = None+ orcid = None+ else:+ full_name = author.get('full_name', None)+ email = author.get('email', None)+ orcid = author.get('orcid', None)
identifiers = [{
'type': 'ORCID',
'identifier': orcid
The text was updated successfully, but these errors were encountered:
dict
. Subsequent code expects a list, and would iterate over a dictionary instead.dict
, and would try to get by key.This is a simple patch that deals with this cases "downstream", but maybe it would be better to change the main parsing loop.
The text was updated successfully, but these errors were encountered: