git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
handle potential exception if db is not under version control
[sfa.git]
/
sfa
/
util
/
xrn.py
diff --git
a/sfa/util/xrn.py
b/sfa/util/xrn.py
index
fb9e864
..
f48a377
100644
(file)
--- a/
sfa/util/xrn.py
+++ b/
sfa/util/xrn.py
@@
-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):
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:
class Xrn:
@@
-161,7
+161,11
@@
class Xrn:
def get_authority_urn(self):
self._normalize()
return ':'.join( [Xrn.unescape(x) for x in self.authority] )
def get_authority_urn(self):
self._normalize()
return ':'.join( [Xrn.unescape(x) for x in self.authority] )
-
+
+ def get_sliver_id(self, slice_id, node_id, index=0):
+ self._normalize()
+ return ":".join(map(str, [self.get_urn(), slice_id, node_id, index]))
+
def urn_to_hrn(self):
"""
compute tuple (hrn, type) from urn
def urn_to_hrn(self):
"""
compute tuple (hrn, type) from urn