Commit 0cb6960b authored by Jeffrey Shell's avatar Jeffrey Shell

Jingled the constructors to allow better backwards compatability with code...

Jingled the constructors to allow better backwards compatability with code that still wants to use the _init() method (and therefor calls the constructor with no args)
parent 7184107c
......@@ -84,7 +84,7 @@
##############################################################################
"""Simple column indices"""
__version__='$Revision: 1.19 $'[11:-2]
__version__='$Revision: 1.20 $'[11:-2]
from Globals import Persistent
from BTree import BTree
......@@ -107,7 +107,7 @@ def nonEmpty(s):
class Index(Persistent):
"""Index object interface"""
def __init__(self,data,schema,id):
def __init__(self,data=None,schema=None,id=None):
"""Create an index
The arguments are:
......@@ -120,12 +120,17 @@ class Index(Persistent):
'id' -- the name of the item attribute to index. This is either
an attribute name or a record key.
"""
self._data=data
self._schema=schema
self.id=id
self._index=BTree()
self._reindex()
######################################################################
# For b/w compatability, have to allow __init__ calls with zero args
if not data==schema==id==None:
self._data=data
self._schema=schema
self.id=id
self._index=BTree()
self._reindex()
else:
pass
# for b/w compatability
_init = __init__
......
......@@ -202,7 +202,7 @@ Notes on a new text index design
space.
"""
__version__='$Revision: 1.14 $'[11:-2]
__version__='$Revision: 1.15 $'[11:-2]
from Globals import Persistent
import BTree, IIBTree
......@@ -217,7 +217,7 @@ import string, regex, regsub
class TextIndex(Persistent):
def __init__(self,data,schema,id):
def __init__(self,data=None,schema=None,id=None):
"""Create an index
The arguments are:
......@@ -230,12 +230,17 @@ class TextIndex(Persistent):
'id' -- the name of the item attribute to index. This is either
an attribute name or a record key.
"""
self._data=data
self._schema=schema
self.id=id
self._index=BTree()
self._syn=stop_word_dict
self._reindex()
######################################################################
# For b/w compatability, have to allow __init__ calls with zero args
if not data==schema==id==None:
self._data=data
self._schema=schema
self.id=id
self._index=BTree()
self._syn=stop_word_dict
self._reindex()
else:
pass
# for backwards compatability
_init = __init__
......
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