We have a Product that contains images like so:

  image collection
     image object

There's going to be a lot of these images, and sometimes they're going to
be big, so we're storing them outside the ZODB. The image object serves the
image up in a variety of sizes, each of which is cached on disk alongside
the raw image. We have a strong requirement that the only way to manipulate
these images is through Zope. Our biggest problem is that there doesn't
appear to be a nice way to clean up those files on disk when the Product is
deleted from Zope.

The obvious solution, using manage_beforeDelete, isn't appropriate, because
the rename and cut operations will both result in _delObject which calls
manage_beforeDelete. I consider this to be a bad design call since there's
no way for _delObject / manage_beforeDelete to know wether the delete is
permanent or "just a rename".

The next solution, __del__, doesn't work either -- even after a ZODB pack
operation, the __del__ method doesn't appear to be called. This also
confuses me.

What I've done is wrap the manage_delObject[s] method of the image
collection object that holds the image objects, and it can call
deleteImages on the subobjects. That's fine 
for actually managing the image objects within the collection, but doesn't
help if someone deletes the image collection object.

Any suggestions?


Richard Jones
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to