[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/PathIndex - PathIndex.py:1.25.6.5.2.1
Casey Duncan
casey@zope.com
Tue, 27 May 2003 00:57:05 -0400
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/PathIndex
In directory cvs.zope.org:/tmp/cvs-serv31018
Modified Files:
Tag: casey-pathindex-cmp-fix-branch
PathIndex.py
Log Message:
Refactor questionable comparisons which could exhibit poor performance with large indexes.
=== Zope/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py 1.25.6.5 => 1.25.6.5.2.1 ===
--- Zope/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py:1.25.6.5 Fri Feb 21 09:41:24 2003
+++ Zope/lib/python/Products/PluginIndexes/PathIndex/PathIndex.py Tue May 27 00:57:04 2003
@@ -84,10 +84,10 @@
level is the level of the component inside the path
"""
- if self._index.has_key(comp)==0:
+ if not self._index.has_key(comp):
self._index[comp] = IOBTree()
- if self._index[comp].has_key(level)==0:
+ if not self._index[comp].has_key(level):
self._index[comp][level] = IITreeSet()
self._index[comp][level].insert(id)
@@ -156,10 +156,10 @@
try:
self._index[comp][level].remove(documentId)
- if len(self._index[comp][level])==0:
+ if not self._index[comp][level]:
del self._index[comp][level]
- if len(self._index[comp])==0:
+ if not self._index[comp]:
del self._index[comp]
except KeyError:
LOG(self.__class__.__name__, ERROR,