[Zope-CMF] Workflow, Events & Indexing

Tres Seaver tseaver@palladion.com
Wed, 18 Jul 2001 07:41:19 -0400 (EDT)


On Tue, 17 Jul 2001, Chris Withers wrote:

> Tres Seaver wrote:
> > 
> > The essence of my notion is that any method which changes
> > catalogable attributes should call 'reindexObject', rather
> > than relying on some underlying magic to get it called.
> 
> This does seem to violate the principle of 'only write the code
> once' :-S If objects recieved a notification that they had
> changed, they could do this re-indexing rather than other
> processes having to worry about this.

Who else is going to tell an object that its attributes have
changed?  The object's own methods are responsible for making
those changes, and therefore for notifying interested observers
of the changes.
 
> For example, what if the arguments to reindexObject change? You
> have find all the places you call it and re-write them.

This discussion started because of a failure in code which
attempts to guess when it would be appropriate to reindex an
object;  guaranteeing that the reindex happens at the right time
is *way* more important than "programmer convenience".

> And what if (as I need to), you need to call something like
> portal_discussion.updateDiscussion(object) when the object
> changes? You need to go find all places the object could change
> (how do you do that?)

Grep for 'reindexObject'. :)

> and add the extra call.
> 
> This feels like something that belongs in a workflow or event
> model.

If / when we add an event channel, the responsibility for publishing
events to it will still rest with the methods which are actually
making changes to the objects;  at that point, your event-based
discussion tool would be a subscriber to the event channel.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org