Merge branch 'master' into eucalyptus-devel
[sfa.git] / sfa / util / xrn.py
index 8ee8331..752e7a9 100644 (file)
@@ -1,7 +1,6 @@
 import re
 
 from sfa.util.faults import *
-from sfa.util.sfalogging import sfa_logger
 
 # for convenience and smoother translation - we should get rid of these functions eventually 
 def get_leaf(hrn): return Xrn(hrn).get_leaf()
@@ -74,7 +73,7 @@ class Xrn:
             self.hrn_to_urn()
 # happens all the time ..
 #        if not type:
-#            sfa_logger().debug("type-less Xrn's are not safe")
+#            debug_logger.debug("type-less Xrn's are not safe")
 
     def get_urn(self): return self.urn
     def get_hrn(self): return self.hrn
@@ -139,7 +138,7 @@ class Xrn:
         if self.hrn.startswith(Xrn.URN_PREFIX):
             raise SfaAPIError, "Xrn.hrn_to_urn, hrn=%s"%self.hrn
 
-        if self.type.startswith('authority'):
+        if self.type and self.type.startswith('authority'):
             self.authority = Xrn.hrn_split(self.hrn)
             type_parts = self.type.split("+")
             self.type = type_parts[0]
@@ -153,9 +152,9 @@ class Xrn:
         authority_string = self.get_authority_urn()
 
         if self.type == None:
-            urn = "+".join(['',authority_string,name])
+            urn = "+".join(['',authority_string,Xrn.unescape(name)])
         else:
-            urn = "+".join(['',authority_string,self.type,name])
+            urn = "+".join(['',authority_string,self.type,Xrn.unescape(name)])
         
         self.urn = Xrn.URN_PREFIX + urn