From 686bb7e2b3e3bdb326553f2094a07d4f987e303b Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Fri, 10 Apr 2020 12:09:57 -0500 Subject: This fixed {'type': 'string?', 'jsonldPredicate': {'_id': 'http://purl.obolibrary.org/obo/UO_0000036'}} {'type': 'string?', 'jsonldPredicate': 'http://purl.obolibrary.org/obo/NCIT_C25688'} Traceback (most recent call last): (...) File "/export/iwrk/opensource/code/vg/bh20-seq-resource/bh20simplewebuploader/main.py", line 106, in walk_fields for item in walk_fields(field_type, parent_keys + [field_name], subtree_optional or optional): File "/export/iwrk/opensource/code/vg/bh20-seq-resource/bh20simplewebuploader/main.py", line 92, in walk_fields ref_url = field_type.get('jsonldPredicate', {}).get('_id', None) AttributeError: 'str' object has no attribute 'get' --- bh20simplewebuploader/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bh20simplewebuploader') diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py index b4e8681..bfc7762 100644 --- a/bh20simplewebuploader/main.py +++ b/bh20simplewebuploader/main.py @@ -88,7 +88,11 @@ def generate_form(schema): if not isinstance(field_type, str): # If the type isn't a string # See if it has a more info/what goes here URL - ref_url = field_type.get('jsonldPredicate', {}).get('_id', None) + predicate = field_type.get('jsonldPredicate', {}) + if not isinstance(predicate, str): + ref_url = predicate.get('_id', None) + else: + ref_url = predicate # not sure this is correct # Grab out its type field field_type = field_type.get('type', '') -- cgit v1.2.3