parts = hrn.split(".")
return ".".join(parts[-1:])
-def get_authority(hrn):
+def get_authority(xrn):
+ hrn, type = urn_to_hrn(xrn)
+ if type and type == 'authority':
+ return hrn
+
parts = hrn.split(".")
return ".".join(parts[:-1])
def email_to_hrn(auth_hrn, email):
parts = email.split("@")
username = parts[0]
- username = username.replace(".", "_")
+ username = username.replace(".", "_").replace("+", "_")
person_hrn = ".".join([auth_hrn, username])
return person_hrn
authority = get_authority(hrn)
name = get_leaf(hrn)
- urn = "+".join([unicode(part).replace('.', ':') \
- for part in ['',authority,type,name]])
-
+
+ if authority.startswith("plc"):
+ if type == None:
+ urn = "+".join(['',authority.replace('.',':'),name])
+ else:
+ urn = "+".join(['',authority.replace('.',':'),type,name])
+
+ else:
+ urn = "+".join(['',authority,type,name])
+
return URN_PREFIX + urn