[email protected]
[Top] [All Lists]

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

Subject: [Zodb-checkins] SVN: ZODB/trunk/ type_and_adr(): Display the oid too.
From: Tim Peters
Date: Thu, 11 Nov 2004 15:59:05 -0500 EST
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()

_______________________________________________
Zodb-checkins mailing list
[email protected]
http://mail.zope.org/mailman/listinfo/zodb-checkins

<Prev in Thread] Current Thread [Next in Thread>
  • [Zodb-checkins] SVN: ZODB/trunk/ type_and_adr(): Display the oid too., Tim Peters <=