[ZODB-Dev] possible bug in Catalog.py with keyword index ?

Joachim Schmitz js at aixtraware.de
Fri Jul 20 04:40:11 EDT 2007


hi,

we use ZCatalogs as tables, to store data for rapid access and 
searching. Recently we added a keyword index to one table, and found 
that the metadata of the index is not updated, when a keyword is 
added.The name of the index and metadata is the same 
"registered_courses". I found in Catalog.py updateMetadata around line 306

         else:
             if data.get(index, 0) != newDataRecord:
                 data[index] = newDataRecord

the if condition evaluates always to false, cause the data.get(index,0) 
accesses the data of the index and not of the metadata field as long as 
Zope was not restarted that worked fine. But after a restart the 
metadata field always only contained the first added keyword, the index
was still ok.
After I changed the above code to:

        else:
             if True or data.get(index, 0) != newDataRecord:
                 data[index] = newDataRecord

It works as exspected.



-- 
Gruß Joachim



More information about the ZODB-Dev mailing list