stuartbishop.net

External Filestorage

This is some example code for storing static files external to the ZODB. This implementation supports Undo. When the last reference to an externally stored file is removed from the ZODB (and the database packed), then the externally referenced file can be garbage collected. In this implementation, the garbage collection routine is launched from a management screen, and files are moved into a 'trash' directory rather than actually being deleted. This code does not rely on manage_afterAdd/manage_beforeDelete hooks to maintain reference counts to the file allowing the files to be stored as attributes on any object type, rather than only as children of an ObjectManager.