Skip to content

Commit

Permalink
DataObject.from_uri attempts all types that claim to support uri
Browse files Browse the repository at this point in the history
  • Loading branch information
janpipek committed Feb 24, 2016
1 parent 6824ed6 commit dde2a73
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion boadata/core/data_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,15 @@ def from_uri(cls, uri, **kwargs):
by checking all registered types.
"""
if cls == DataObject:
last_exception = None
for type_ in DataObject.registered_types.values():
if type_.accepts_uri(uri):
return type_.from_uri(uri, **kwargs)
try:
return type_.from_uri(uri, **kwargs)
except Exception as exc:
last_exception = exc
if last_exception:
raise exc
raise BaseException("Cannot interpret " + uri + ".")
else:
inner_data = odo.odo(uri, cls.real_type, **kwargs)
Expand Down

0 comments on commit dde2a73

Please sign in to comment.