[ZODB-Dev] __del__ with Persistent objects

Stuart Bishop zen at shangri-la.dropbear.id.au
Fri Jul 18 00:05:49 EDT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi.

I'm trying to determine if it is possible for a Persistent object
to sanely clean up external resources it uses. In this case, an
object that stores a blob of data in file on the filesystem.

Can the __del__ method be used to remove the external file?
Basic tests seem to say yes. Can I rely on this behaviour?
I'm particularly interested with Zope 2.6.2b2

__del__ appears to be called when the last reference to the
Persistent object is removed from the ZODB. However, it is
possible to undo this transaction.

Assuming there is no way to do defer the cleanup until the
relevant transaction is removed in a database pack, is there
any way for an object to recognize when it has been resurrected
with undo?

Is it possible for an object to ensure if it is removed, that the
removal cannot be undone?

- -- 
Stuart Bishop <zen at shangri-la.dropbear.id.au>
http://shangri-la.dropbear.id.au/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (Darwin)

iD8DBQE/Fp8yh8iUz1x5geARAsm4AJwMsgkQq7vclceQ5pxUNpMH1LkWPQCghqAT
5WJNW/69tszASeOrhfT7w7g=
=EL+2
-----END PGP SIGNATURE-----




More information about the ZODB-Dev mailing list