[Zope-Checkins] CVS: Products/PluginIndexes/PathIndex - PathIndex.py:

Tres Seaver tseaver at palladion.com
Sat May 28 20:42:13 EDT 2005

Update of /cvs-repository/Products/PluginIndexes/PathIndex
In directory cvs.zope.org:/tmp/cvs-serv32028/lib/python/Products/PluginIndexes/PathIndex

Modified Files:
      Tag: tseaver-hasattr_geddon-branch
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?

=== Products/PluginIndexes/PathIndex/PathIndex.py => ===
--- Products/PluginIndexes/PathIndex/PathIndex.py:	Sat Jan 24 10:49:32 2004
+++ Products/PluginIndexes/PathIndex/PathIndex.py	Sat May 28 20:41:32 2005
@@ -22,6 +22,7 @@
 from BTrees.IIBTree import IITreeSet, IISet, intersection, union
 from BTrees.Length import Length
 from zLOG import LOG, ERROR
+from ZODB.utils import safe_hasattr
 from Products.PluginIndexes import PluggableIndex
 from Products.PluginIndexes.common.util import parseIndexRequest
@@ -207,7 +208,7 @@
     def _migrate_length(self):
         """ migrate index to use new _length attribute """
-        if not hasattr(self, '_length'):
+        if not safe_hasattr(self, '_length'):
             self._length = Length(len(self._unindex))
     def _apply_index(self, request, cid=''):

More information about the Zope-Checkins mailing list