more, and more legible, debug messages in the cert verification area
[sfa.git] / sfa / trust / gid.py
index 6e668fa..ad991c1 100644 (file)
 # descendant of the certificate class.
 ##
 
-import xmlrpclib
+from __future__ import print_function
+
 import uuid
 
 from sfa.trust.certificate import Certificate
 
 from sfa.util.faults import GidInvalidParentHrn, GidParentHrn
-from sfa.util.sfalogging import logger
 from sfa.util.xrn import hrn_to_urn, urn_to_hrn, hrn_authfor_hrn
+from sfa.util.sfalogging import logger
+from sfa.util.py23 import xmlrpc_client
 
 ##
 # Create a new uuid. Returns the UUID as a string.
@@ -174,7 +176,7 @@ class GID(Certificate):
         dict = {}
         if data:
             if data.lower().startswith('uri:http://<params>'):
-                dict = xmlrpclib.loads(data[11:])[0][0]
+                dict = xmlrpc_client.loads(data[11:])[0][0]
             else:
                 spl = data.split(', ')
                 for val in spl:
@@ -201,7 +203,7 @@ class GID(Certificate):
     # @param dump_parents If true, also dump the parents of the GID
 
     def dump(self, *args, **kwargs):
-        print self.dump_string(*args,**kwargs)
+        print(self.dump_string(*args,**kwargs))
 
     def dump_string(self, indent=0, dump_parents=False):
         result=" "*(indent-2) + "GID\n"
@@ -229,6 +231,7 @@ class GID(Certificate):
     # planetlab.us.arizona cannot sign a GID for planetlab.us.princeton.foo.
 
     def verify_chain(self, trusted_certs = None):
+        logger.debug("GID.verify_chain with {} trusted certs".format(len(trusted_certs)))
         # do the normal certificate verification stuff
         trusted_root = Certificate.verify_chain(self, trusted_certs)