[Zope-CMF] ZMI edits and reindexing

Florent Guillaume fg@nuxeo.com
Sat, 3 Aug 2002 15:56:49 +0000 (UTC)


Yuppie posted a problem in the Collector (#22) which led me to this
question:

Should edits from the ZMI reindex the document afterwards? I would say
yes, they should, but it's not always straightforward...

The current state of affairs is that Document.manage_editDocument
does reindex, but
1. the manage_* defined in CMF don't:
    DefaultDublinCoreImpl.manage_editMetadata
    Link.manage_editLink
2. the manage_* inherited from OFS.Image and File don't:
    manage_edit
    manage_upload (but then there shouldn't be anything to reindex)
3. even then, we'd still have to deal with changes from the Properties tab.

The first point can be easily corrected.

The second point can be corrected by wrapping those methods in a CMF
version that does reindexing afterwards.

The third point is more complex. In developments for my clients I
monkey-patch PropertyManager._setPropValue to:
    def _setPropValue(self, id, value):
        self._wrapperCheck(value)
        old_value = getattr(aq_base(self), id, None)
        setattr(self, id, value)
        if hasattr(aq_base(self), 'manage_afterPropertyChange'):
            self.manage_afterPropertyChange(id, old_value)
which allows me to do reindexing if needed.


Opinions on the directions to follow?

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com