X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Futil%2Fxrn.py;h=19b1fc18a0f0607ab4dadf4bda36228a11d6b896;hb=1db1a879ffde8991aa95dd80142d555551655e88;hp=c9c8db0b09f3c4957bf2bc25d6a07c5c61e374a1;hpb=b99599579ebf6f4a4d0eca53bcc738b333227f06;p=sfa.git diff --git a/sfa/util/xrn.py b/sfa/util/xrn.py index c9c8db0b..19b1fc18 100644 --- a/sfa/util/xrn.py +++ b/sfa/util/xrn.py @@ -22,7 +22,7 @@ #---------------------------------------------------------------------- import re - +import sys from sfa.util.faults import SfaAPIError # for convenience and smoother translation - we should get rid of these functions eventually @@ -93,11 +93,12 @@ class Xrn: return False ########## basic tools on URNs - URN_PREFIX = "urn:publicid:idn" + URN_PREFIX = "urn:publicid:IDN" + URN_PREFIX_lower = "urn:publicid:idn" @staticmethod def is_urn (text): - return text.lower().startswith(Xrn.URN_PREFIX) + return text.lower().startswith(Xrn.URN_PREFIX_lower) @staticmethod def urn_full (urn): @@ -120,6 +121,7 @@ class Xrn: # 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 @@ -153,7 +155,8 @@ class Xrn: # 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