Code

Added 'Users may only edit their issues' customisation example.
[roundup.git] / roundup / indexer.py
index 4295b70167573e4b76e749abe51a466b1496be12..ef697d938f968bb475c57026124f45ad64fdfcfd 100644 (file)
@@ -14,7 +14,7 @@
 #     that promote freedom, but obviously am giving up any rights
 #     to compel such.
 # 
-#$Id: indexer.py,v 1.13 2002-09-10 00:18:20 richard Exp $
+#$Id: indexer.py,v 1.16 2003-01-14 03:56:44 richard Exp $
 '''
 This module provides an indexer class, RoundupIndexer, that stores text
 indices in a roundup instance.  This class makes searching the content of
@@ -169,6 +169,10 @@ class Indexer:
                     nodeids[nodeid] = {}
                 continue
 
+            # make sure the class is a linked one, otherwise ignore
+            if not designator_propname.has_key(classname):
+                continue
+
             # it's a linked class - set up to do the klass.find
             linkprop = designator_propname[classname]   # eg, msg -> messages
             propspec[linkprop][nodeid] = 1
@@ -217,6 +221,8 @@ class Indexer:
             if hits is None:
                 hits = {}
                 for k in entry.keys():
+                    if not self.fileids.has_key(k):
+                        raise ValueError, 'Index is corrupted: re-generate it'
                     hits[k] = self.fileids[k]
             else:
                 # Eliminate hits for every non-match