Commit bbfa8133 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Make code more robust against invalid ids

parent 26edf18a
......@@ -77,4 +77,8 @@ def convert_string_to_dbxref(string):
A dbxref is dictionary with two keys: db and id.
"""
split = string.split(':', 1)
return {'db': split[0], 'id': split[1]}
if len(split) > 1:
return {'db': split[0], 'id': split[1]}
else:
# invalid dbxref. nevertheless return a valid dbxref object with the value as the db and a empty id.
return {'db': split[0], 'id': ''}
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