Commit f0884090 authored by 's avatar

Added forgotten checkin

parent 1d3d18f0
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Simple column indices""" """Simple column indices"""
__version__='$Revision: 1.25 $'[11:-2] __version__='$Revision: 1.26 $'[11:-2]
from Globals import Persistent from Globals import Persistent
from BTree import BTree from BTree import BTree
...@@ -206,9 +206,7 @@ class Index(Persistent): ...@@ -206,9 +206,7 @@ class Index(Persistent):
def index_item(self, i, obj=None): def index_item(self, i, obj=None):
"""Recompute index data for data with ids >= start.""" """Recompute index data for data with ids >= start."""
index = self._index index = self._index
id = self.id id = self.id
if (self._schema is None) or (obj is not None): if (self._schema is None) or (obj is not None):
f = getattr f = getattr
...@@ -219,16 +217,12 @@ class Index(Persistent): ...@@ -219,16 +217,12 @@ class Index(Persistent):
if obj is None: if obj is None:
obj = self._data[i] obj = self._data[i]
try: try: k=f(obj, id)
if self.call_methods: except: return
k = f(obj, id)() if self.call_methods:
else: k=k()
k = f(obj, id) if k is None or k == MV:
except: return
pass
if k is None or k == MV: return
set = index.get(k) set = index.get(k)
if set is None: index[k] = set = intSet() if set is None: index[k] = set = intSet()
...@@ -237,24 +231,23 @@ class Index(Persistent): ...@@ -237,24 +231,23 @@ class Index(Persistent):
def unindex_item(self, i, obj=None): def unindex_item(self, i, obj=None):
"""Recompute index data for data with ids >= start.""" """Recompute index data for data with ids >= start."""
index = self._index index = self._index
id = self.id id = self.id
if self._schema is None: if self._schema is None:
f = getattr f = getattr
else: else:
f = operator.__getitem__ f = operator.__getitem__
id = self._schema[id] id = self._schema[id]
if obj is None: if obj is None:
obj = self._data[i] obj = self._data[i]
try: k=f(obj, id)
except: return
if self.call_methods: if self.call_methods:
k = f(obj, id)() k=k()
else: if k is None or k == MV:
k = f(obj, id) return
set = index.get(k) set = index.get(k)
if set is not None: set.remove(i) if set is not None: set.remove(i)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment