X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Futil%2Fxrn.py;h=f48a37732a713796ef316d8997ea7199d77aa741;hb=b7d6a80faf23cb019c74e65c2264e215446f84a3;hp=3dc87b63d3717c0e1b40bf69a7bff0305144b0be;hpb=0d48b2ca1c2f5f66712b15d7542afbb6a0c67409;p=sfa.git diff --git a/sfa/util/xrn.py b/sfa/util/xrn.py index 3dc87b63..f48a3773 100644 --- a/sfa/util/xrn.py +++ b/sfa/util/xrn.py @@ -23,7 +23,7 @@ import re -from sfa.util.faults import * +from sfa.util.faults import SfaAPIError # for convenience and smoother translation - we should get rid of these functions eventually def get_leaf(hrn): return Xrn(hrn).get_leaf() @@ -33,7 +33,7 @@ def hrn_to_urn(hrn,type): return Xrn(hrn, type=type).urn def hrn_authfor_hrn(parenthrn, hrn): return Xrn.hrn_is_auth_for_hrn(parenthrn, hrn) def urn_to_sliver_id(urn, slice_id, node_id, index=0): - return ":".join(map(str, [urn, slice_id, node_id, index])) + return Xrn(urn).get_sliver_id(slice_id, node_id, index) class Xrn: @@ -98,7 +98,7 @@ class Xrn: @staticmethod def urn_full (urn): if urn.startswith(Xrn.URN_PREFIX): return urn - else: return Xrn.URN_PREFIX+URN + else: return Xrn.URN_PREFIX+urn @staticmethod def urn_meaningful (urn): if urn.startswith(Xrn.URN_PREFIX): return urn[len(Xrn.URN_PREFIX):] @@ -130,6 +130,13 @@ class Xrn: # if not type: # debug_logger.debug("type-less Xrn's are not safe") + def __repr__ (self): + result="