Update of /cvs-repository/ZODB3/Tools In directory cvs.zope.org:/tmp/cvs-serv32028/utilities/ZODBTools
Modified Files: Tag: tseaver-hasattr_geddon-branch checkbtrees.py Log Message: - Removed all uses of the 'hasattr' builtin from the core, where the object being tested derives (or might) from Persistent. XXX: currently, this branch imports a 'safe_hasattr' from ZODB.utils, which adds a dependency on ZODB for some packages; we probably need a better location, and perhas a C implementation? === ZODB3/Tools/checkbtrees.py 1.1.30.2 => 1.1.30.2.26.1 === --- ZODB3/Tools/checkbtrees.py:1.1.30.2 Thu Mar 18 08:24:02 2004 +++ ZODB3/Tools/checkbtrees.py Sat May 28 20:41:39 2005 @@ -12,6 +12,7 @@ import ZODB from ZODB.FileStorage import FileStorage +from ZODB.utils import safe_hasattr from BTrees.check import check # Set of oids we've already visited. Since the object structure is @@ -26,7 +27,7 @@ global oids_seen getattr(obj, '_', None) # unghostify - if hasattr(obj, '_p_oid'): + if safe_hasattr(obj, '_p_oid'): oid = obj._p_oid if not oids_seen.has_key(oid): L.append((obj, path)) @@ -83,7 +84,7 @@ mod = str(obj.__class__.__module__) if mod.startswith("BTrees"): - if hasattr(obj, "_check"): + if safe_hasattr(obj, "_check"): try: obj._check() except AssertionError, msg: _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins