X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Futil%2Fnamespace.py;h=f53808cb5b5a989333b5b1ec99af0ec1002ecb73;hb=595d976060944cf80e6bafe4e4c99e33de34fe83;hp=53a28005189a0bf67148b8a0ba42606b42ae710c;hpb=38b7e03d8b94ee925f0886090757980ba9abc45b;p=sfa.git diff --git a/sfa/util/namespace.py b/sfa/util/namespace.py index 53a28005..f53808cb 100644 --- a/sfa/util/namespace.py +++ b/sfa/util/namespace.py @@ -65,19 +65,18 @@ def urn_to_hrn(urn): name = urn[len(URN_PREFIX):] hrn_parts = name.split("+") - type = hrn_parts.pop(2) + # Remove the authority name (e.g. '.sa') + if type == 'authority': + hrn_parts = hrn_parts[:-1] + # convert hrn_parts (list) into hrn (str) by doing the following # remove blank elements # replace ':' with '.' # join list elements using '.' hrn = '.'.join([part.replace(':', '.') for part in hrn_parts if part]) - # Remove the authority name (e.g. '.sa') - if type == 'authority': - hrn = hrn.replace ('.sa', '') - return str(hrn), str(type)