Move printRecord into rspec class (as pprint).
[sfa.git] / cmdline / getRecord.py
index 12971d9..24b2ac9 100755 (executable)
@@ -32,22 +32,6 @@ def create_parser():
    
     return parser    
 
-def printRecord(r, depth = 0):
-    line = ""
-    # Set the dept
-    for tab in range(0,depth): line += "    "
-    # check if it's nested
-    if type(r) == dict:
-        for i in r.keys(): 
-            print line + "%s:" % i
-            printRecord(r[i], depth + 1)
-    elif type(r) in (tuple, list):
-        for j in r: printRecord(j, depth + 1)
-    # not nested so just print.
-    else:
-        print line + "%s" %  r
-
-
 def findRoot(r, filter):
     root = None
     if type(r) == dict:
@@ -88,9 +72,9 @@ def main():
         if options.DEBUG: 
             print "Filtering on key: %s" % args[0]
             pprint(findRoot(record.dict, args[0]))
-        printRecord({args[0]: findRoot(record.dict, args[0])})
+        record.pprint({args[0]: findRoot(record.dict, args[0])})
     else:
-        printRecord(record.dict)
+        record.pprint(record.dict)
 
 if __name__ == '__main__':
     try: main()