[Zope3-dev] manage_befroeDelete?!

Steve Alexander steve@cat-box.net
Fri, 10 May 2002 12:44:43 +0100


Chris Withers wrote:
> Casey Duncan wrote:
> 
>>container (just like creation). What you can do, though is abstract this
>>functionality in some way so that some application defined flag affects the
>>behavior on a per object basis, and/or hook manage_beforeDelete on the
>>object(s) to raise an exception when the object should not be deleted.
> 
> 
> I do hope this isn't a Zope 3 solution?!
> 
> Please tell me these nasty-hooks-which-should-be-replaced-by-the-ObjectHub aren't still
> around?!?!

I don't know that the ObjectHub is an exact match for this.

It would be easy to build a flexible and adaptable mechanism for 
managing the deletion of contained objects.

Trivial example to illustrate the pattern:

   Having an interface IAcceptsDeleteNotification that defines the method
   notifyBeforeDelete().

   When an item is about to be deleted from a container, the container
   asks for an adapter from the object to be deleted, adapting to
   IAcceptsDeleteNotification.

   The object itself can implement IAcceptsDeleteNotification, or an
   independent adapter can be registered for particular kinds of object.

--
Steve Alexander