[Zope-Checkins] CVS: ZODB3/Tools - fsrefs.py:1.7

Jeremy Hylton jeremy@zope.com
Fri, 23 May 2003 17:30:31 -0400


Update of /cvs-repository/ZODB3/Tools
In directory cvs.zope.org:/tmp/cvs-serv12973/Tools

Modified Files:
	fsrefs.py 
Log Message:
Add -v option to control whether tracebacks are printed.


=== ZODB3/Tools/fsrefs.py 1.6 => 1.7 ===
--- ZODB3/Tools/fsrefs.py:1.6	Tue Mar  4 13:33:52 2003
+++ ZODB3/Tools/fsrefs.py	Fri May 23 17:30:31 2003
@@ -32,6 +32,8 @@
 import traceback
 import types
 
+VERBOSE = 0
+
 def get_refs(pickle):
     refs = []
     f = cStringIO.StringIO(pickle)
@@ -67,7 +69,8 @@
             data, serial = fs.load(oid, "")
         except:
             print "oid %s failed to load" % hex(u64(oid))
-            traceback.print_exc()
+            if VERBOSE:
+                traceback.print_exc()
             noload[oid] = 1
 
             # XXX If we get here after we've already loaded objects
@@ -93,4 +96,12 @@
 
 if __name__ == "__main__":
     import sys
-    main(sys.argv[1])
+    import getopt
+
+    opts, args = getopt.getopt(sys.argv[1:], "v")
+    for k, v in opts:
+        if k == "-v":
+            VERBOSE += 1
+
+    path, = args
+    main(path)