[ZCM] [ZC] 2342/ 1 Request "bug in Catalog.py metadata not updated with keyword index"

"Collector: Zope Bugs, Features, and Patches ..." <[email protected]> Fri, 20 Jul 2007 05:06:55 -0400
Newsgroups gmane.comp.web.zope.devel.collector-monitor
Message-ID <[email protected]>
Issue #2342 Update (Request) "bug in Catalog.py metadata not updated with keyword index"
 Status Pending, Catalog/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/2342

==============================================================
= Request - Entry #1 by perry on Jul 20, 2007 5:06 am

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

==============================================================