From 8faabd3ebf6ddac33e0e455b0776ca4ef9287242 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Fri, 2 Nov 2018 19:04:27 +0100 Subject: [PATCH] Cython, URI: Fixed a bug when using an output URI with just a view name to use the default DMS --- python/obitools3/uri/decode.pyx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/python/obitools3/uri/decode.pyx b/python/obitools3/uri/decode.pyx index 74d44d7..089cecd 100755 --- a/python/obitools3/uri/decode.pyx +++ b/python/obitools3/uri/decode.pyx @@ -99,7 +99,7 @@ def open_dms_element(DMS dms, view = newviewtype.new(dms,path_parts[0]) else: view = newviewtype.open(dms,path_parts[0]) - + if len(path_parts) > 1: if path_parts[1]==b'*': if len(path_parts) == 2: @@ -196,7 +196,11 @@ def open_uri(uri, (((not input) and "outputformat" not in config["obi"]) or \ (input and "inputformat" not in config["obi"]))): # TODO maybe not best way - dms = open_dms(urip.path, create) + if default_dms is not None and b"/" not in urip.path: # assuming view to open in default DMS (TODO discuss) + dms=(default_dms, urip.path) + else: + dms = open_dms(urip.path, create) + if dms is None and default_dms is not None: dms=(default_dms, urip.path) @@ -232,7 +236,7 @@ def open_uri(uri, if obi_errno == OBIVIEW_ALREADY_EXISTS_ERROR: raise Exception("View name already exists in this DMS") error=e - + if scheme==b"dms" : logger('Error','Could not open DMS URI: %s', uri) raise FileNotFoundError()