[ZODB-Dev] Before-abort hook?
Stefan H. Holek
stefan at epy.co.at
Fri Mar 24 04:58:53 EST 2006
Hi all,
The ExtFile product I maintain keeps its payload on the filesystem.
All operations are performed using temporary files which are then
saved or deleted on transaction commit or abort respectively.
To this end an ExtFile provides _finish and _abort methods which are
hooked up to a TM. Since Zope 2.8 (MVCC) I have a problem with
aborts. On abort the machinery apparently nukes an ExtFile's
persistent attributes, and I lose all information I need to clean up
the external resources (filename, path, etc).
What I need is a way to guarantee my cleanup code is called *before*
the persistent part of my object vanishes. I currently manipulate the
transaction's _resources list directly [1], but that's obviously not
desirable. I have seen synchronizers, but I am unable to tell whether
a beforeCompletion will end up to be a commit or abort.
We now have before-commit hooks, and it seems what I need is a before-
abort hook as well.
Thoughts appreciated,
Stefan
[1] http://dev.plone.org/collective/browser/ExtFile/trunk/TM.py
--
Anything that happens, happens. --Douglas Adams
More information about the ZODB-Dev
mailing list