[Zope-dev] Python objects and transactions

Duncan Booth duncan@rcp.co.uk
Mon, 21 Feb 2000 12:26:16 +0000


Is there an easy way for a python object to know when a web 
request has completed?

For example, if I have an object that needs to do some setup and 
tidy up around operations, I want to group operations together if 
possible, but I don't want to delay the tidy up until the object is 
thrown out of the cache.

I have tried using the mixin class Shared.DC.ZRDB.TM and defining 
_abort, _finish, but without much success. The first time I call 
_register the _finish method is called as I expected, but the 
transaction forces a commit, which writes the object to the ZODB 
with _registered set to 1 so that subsequent attempts to start a 
transaction fail. Besides, this forces a transaction on the ZODB 
which I would really rather avoid.

-- 
Duncan Booth                                             duncan@dales.rmplc.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?
http://dales.rmplc.co.uk/Duncan