Dieter Maurer <[EMAIL PROTECTED]> wrote:
> Christian Heimes wrote at 2005-4-1 22:28 +0200:
> > ...
> >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
> I do not think that Florent wants to execute things at the end
> or in the first commit phase. Instead, he wants to execute something
> *BEFORE* this phase.
Yes, wherever it's inserted, I want to do additional processing before
everything is finalized, and in some cases I want to be able to abort
the transaction, and to create and change objects in the ZODB.
> >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.
> This will not work for Florent's use case,
> at least not in the current ZODB (for Zope 2.7).
> The transaction freezes the set of objects it processes
> in the commit *BEFORE* the first commit phase.
> Therefore, no "tpc_vote" is allowed to modify any persistent
> object. Failure to do so leads to extremely nasty
> persistency errors (the object is marked changed but
> no transaction knows about it -- no change to this object in the future
> will get persisted until a restart).
Ah, that was what I was afraid of, but I was assured it was not the
case. I'll have to reread that transaction code... and maybe readd the
low-tech post-publishing hook I was thinking of.
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com [EMAIL PROTECTED]
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -