[Zope-dev] is there a hook for before the transaction is comm itted

Tim McLaughlin tim@BCSWebservices.net
Mon, 5 Mar 2001 12:18:52 -0500


I want to be able to raise an event from the property sheets to the product
if a property changes.  I'm calling it manage_afterChange.  I want it only
to fire once per transaction so that multiple changes are aggregated.
Here's the declaration I have in mind.

manage_afterChange(oldItems, newItems)
oldItems: dict of id - values before modifications
newItems: dict of new values at end of transaction

This would allow an elegant "reindex" or notification system for objects.
It would also allow for validation (ie. raise error if you don't like
newItems).  Anyway, that's it.  I'm halfway there, just can't get a method
to be called on my object _just_ before commit.

Cheers,
Tim

ps.  I'm not so sure that __getstate__ will do this for me, but that's
probably cause I have no idea what __getstate__ does.  It just doesn't sound
right  ;-)

-----Original Message-----
From: Toby Dickenson [mailto:tdickenson@devmail.geminidataloggers.co.uk]
Sent: Monday, March 05, 2001 12:08 PM
To: Tim McLaughlin
Cc: 'zope-dev@zope.org'
Subject: Re: [Zope-dev] is there a hook for before the transaction is
committed


On Mon, 5 Mar 2001 10:56:38 -0500, Tim McLaughlin
<tim@BCSWebservices.net> wrote:

>Is there a hook for before the transaction is committed for objects which
>subclass Persistent?

__getstate__ ?

But why would you want that?



Toby Dickenson
tdickenson@geminidataloggers.com