[Zope-CMF] Re: Don't always set the modification date?
yuppie
y.2005- at wcm-solutions.de
Thu Feb 17 05:35:28 EST 2005
Hi Paul!
Paul Winkler wrote:
> On Wed, Feb 16, 2005 at 03:53:38PM +0100, Florent Guillaume wrote:
>
>>Paul Winkler <pw_lists at slinkp.com> wrote:
>>
>>>but doesn't update the brain / metadata in the catalog.
>>
>>That one is really a bug in ZCatalog. :-( I can't find a report about
>>it, but I thought I saw patches floating around to fix this.
>
>
> Are you sure ZCatalog still behaves that way?
> I don't have time to explore much at the moment but glancing
> at the code, it looks like the intent is for the metadata to
> be updated.
>
>>From ZCatalog.py in a Zope 2.7.3 installation:
>
> def catalog_object(self, obj, uid=None, idxs=None, update_metadata=1):
> ^^^^^^^^^^^^^^^^^
>
> ... and from CatalogTool in CMFCore 1.4.3:
>
> def catalog_object(self, object, uid, idxs=[]):
> ...
> ZCatalog.catalog_object(self, w, uid, idxs)
>
> ...
> def reindexObject(self, object, idxs=[]):
> ...
> self.catalog_object(object, url, idxs=idxs)
>
>
> AFAICT, the only time that updating metadata is suppressed
> is in ZCatalog.reindexIndex().
>
> I'll test this later and see if my reading is correct.
Oops! I did remember this was an issue but I forgot it was resolved.
Sorry for the confusion.
>>>>Occasionally I use this workaround:
>>>>
>>>> obj.reindexObject(idxs=['suppress_notifyModified'])
>>
>>That's a working workaround yes.
>
> let me see if i'm following this - so, you're relying on
> the fact that CMFCatalogAware.reindexObject() doesn't check
> the validity of index names, and only calls notifyModified()
> if the index list is empty? (I don't get why it does that
> anyway. What's reason for wanting different behavior when
> you pass specific indexes?)
>
> At first I wondered why this workaround was described as "expensive"
> - then I realized it's the difference between updating all indexes vs.
> updating only the 'modified' index. As far as that goes, there
> are times I might want to do either one.
Correct. But I can't see a use case for that workaround in Zope 2.7.0
and later.
Cheers,
Yuppie
More information about the Zope-CMF
mailing list