Florent Guillaume wrote:
I really could use a post publishing hook.
Standard use case: delay indexing at the end of the request to only do it once per object even if the object has been modified 4 times.

Using a post publishing hook for this use case isn't a good idea - IMO. The Publisher has nothing to with indexing. It's a completly different part of the architecture.

You want to bind some actions to the transaction system because you want to execute some code at the end of the first phase of the 2 phase commit. That's a completly different story than the post publishing hook. Hooking into the transaction machinery of ZODB is very easy. Write your own DateManager implementing the IDateManager interface and register it into the current transaction using get_transaction.register(DM).

For your use case overwrite the tpc_vote() method of the data manager to do the indexing at the boundary between the two phases.

Jens Vagenpohl's mail host and Chris McD's blob have example code for you.


Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to