use pprint to pretty print version
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Mon, 12 Dec 2011 15:34:12 +0000 (16:34 +0100)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Mon, 12 Dec 2011 15:34:12 +0000 (16:34 +0100)
sfa/client/sfi.py

index d4b095c..8b727f0 100644 (file)
@@ -1,5 +1,8 @@
-
-# xxx NOTE this will soon be reviewed to take advantage of sfaclientlib
+# 
+# sfi.py - basic SFA command-line client
+# the actual binary in sfa/clientbin essentially runs main()
+# this module is used in sfascan
+# 
 
 import sys
 sys.path.append('.')
@@ -12,6 +15,7 @@ import pickle
 from lxml import etree
 from StringIO import StringIO
 from optparse import OptionParser
+from pprint import PrettyPrinter
 
 from sfa.trust.certificate import Keypair, Certificate
 from sfa.trust.gid import GID
@@ -648,8 +652,8 @@ or version information about sfi itself
                 server = self.sliceapi()
             result = server.GetVersion()
             version = ReturnValue.get_value(result)
-        for (k,v) in version.iteritems():
-            print "%-20s: %s"%(k,v)
+        pprinter = PrettyPrinter(indent=4)
+        pprinter.pprint(version)
         if options.file:
             save_variable_to_file(version, options.file, options.fileformat)