#----------------------------------------------------------------------
import re
-
+import sys
from sfa.util.faults import SfaAPIError
# for convenience and smoother translation - we should get rid of these functions eventually
# provide either urn, or (hrn + type)
def __init__ (self, xrn, type=None):
if not xrn: xrn = ""
+
# user has specified xrn : guess if urn or hrn
if Xrn.is_urn(xrn):
self.hrn=None
# self.authority keeps a list
if not hasattr(self,'authority'):
self.authority=Xrn.hrn_auth_list(self.hrn)
-
+
+
def get_leaf(self):
self._normalize()
return self.leaf
if self.type and self.type.startswith('authority'):
self.authority = Xrn.hrn_auth_list(self.hrn)
leaf = self.get_leaf()
- if not self.authority:
- self.authority = [self.hrn]
+ #if not self.authority:
+ # self.authority = [self.hrn]
type_parts = self.type.split("+")
self.type = type_parts[0]
name = 'sa'
if len(type_parts) > 1:
name = type_parts[1]
- authority_string = ":".join([self.get_authority_urn(), leaf])
+ auth_parts = [part for part in [self.get_authority_urn(), leaf] if part]
+ authority_string = ":".join(auth_parts)
else:
self.authority = Xrn.hrn_auth_list(self.hrn)
name = Xrn.hrn_leaf(self.hrn)