[Zope] updating the catalog - successfully!

josh on josh@futurefarmers.com
Mon, 11 Dec 2000 02:36:21 -0800


I was having a lot of problems with keeping a catalog up to date when I
manipulated data in an instance of a zclass (catalog aware).  I was calling
this, from a dtml file in the same folder as the instances, and one folder
down from the Catalog:

<dtml-call "_[userid].propertysheets[1].manage_changeProperties(REQUEST)">
<dtml-call reindex_object>

This just was not re-indexing the Catalog successfully at all.  I checked
the zope list and I think that a lot of people have had the same problem,
including myself a few months back... All the answers suggest using:

<dtml-call reindex_object>

or even:

<dtml-call reindex_object>
<dtml-call reindex_object>

So I just littered that all through my code in the vein hope that the
Catalog would get the hint. But it was stubborn.  The data would be altered,
meanwhile the Catalog remained oblivious.

The good news is that I have seemingly found a way to update my catalog by
making a method of my zclass called update_dtml which I call when change the
data of an instance. the method contains only one thing (of course):

<dtml-call reindex_object>

I call it from the dtml that manipulates the data of the instance (from a
file in the same directory as the instances):

<dtml-call "_[userid].propertysheets[1].manage_changeProperties(REQUEST)">
<dtml-in "objectValues(['zclassuser'])">
<dtml-var update_dtml></dtml-in>

The bad news is that I don't have a clear understanding of why this works. I
guess that the <dtml-call reindex_object> is context sensitive and is a
method of the zclass, so it needs to be called from there.

Does this make sense ?  If it does I think that it should be turned into a
how to.

or am I just being silly?

josh on

===========================
write: josh@futurefarmers.com
read: www.futurefarmers.com
read: www.crd.rca.ac.co.uk/~josh
interrupt (i love it): (415) 552 2124
=============================