[Zodb-checkins] SVN: ZODB/trunk/ type_and_adr(): Display the oid too.

Tim Peters tim.one at comcast.net
Thu Nov 11 15:59:05 EST 2004


Log message for revision 28441:
  type_and_adr():  Display the oid too.
  

Changed:
  U   ZODB/trunk/NEWS.txt
  U   ZODB/trunk/src/BTrees/check.py

-=-
Modified: ZODB/trunk/NEWS.txt
===================================================================
--- ZODB/trunk/NEWS.txt	2004-11-11 20:13:55 UTC (rev 28440)
+++ ZODB/trunk/NEWS.txt	2004-11-11 20:59:05 UTC (rev 28441)
@@ -76,7 +76,13 @@
 
 The C header file ``ring.h`` is now installed.
 
+Tools
+-----
 
+- ``BTrees.check.display()`` now displays the oids (if any) of the
+  BTree's or TreeSet's constituent objects.
+
+
 What's new in ZODB3 3.3?
 ========================
 Release date: 06-Oct-2004

Modified: ZODB/trunk/src/BTrees/check.py
===================================================================
--- ZODB/trunk/src/BTrees/check.py	2004-11-11 20:13:55 UTC (rev 28440)
+++ ZODB/trunk/src/BTrees/check.py	2004-11-11 20:59:05 UTC (rev 28441)
@@ -39,7 +39,7 @@
 from BTrees.IOBTree import IOBTree, IOBucket, IOSet, IOTreeSet
 from BTrees.IIBTree import IIBTree, IIBucket, IISet, IITreeSet
 
-from ZODB.utils import positive_id
+from ZODB.utils import positive_id, oid_repr
 
 TYPE_UNKNOWN, TYPE_BTREE, TYPE_BUCKET = range(3)
 
@@ -200,7 +200,11 @@
     return keys, values
 
 def type_and_adr(obj):
-    return "%s (0x%x)" % (type(obj).__name__, positive_id(obj))
+    if hasattr(obj, '_p_oid'):
+        oid = oid_repr(obj._p_oid)
+    else:
+        oid = 'None'
+    return "%s (0x%x oid=%s)" % (type(obj).__name__, positive_id(obj), oid)
 
 # Walker implements a depth-first search of a BTree (or TreeSet or Set or
 # Bucket).  Subclasses must implement the visit_btree() and visit_bucket()



More information about the Zodb-checkins mailing list