[Zope3-Users] Object-deleted-events
Tobias Rodäbel
tobias.rodaebel at mac.com
Mon Jan 7 08:30:44 EST 2008
Hi,
I'd like to implement an event to be fired when an InternalPrincipal
shall be deleted from a PrincipalFolder.
class IObjectShallBeDeletedEvent(IObjectEvent):
"""Event, when an object will be deleted.
"""
class ObjectShallBeDeletedEvent(object):
"""Event, when an object will be deleted.
"""
implements(IObjectDeletedEvent)
def __init__(self, obj):
self.object = obj
class MyPrincipal(InternalPrincipal):
def __del__(self):
notify(ObjectShallBeDeletedEvent(self))
super(MyObject, self).__del__()
Because of some reason my event will not be fired. Did I miss something?
For now I implemented this by subclassing PrincipalFolder and adding
my notify call to the __delitem__ method. That works well. But I would
prefer an implementation like drafted above.
Regards,
Tobias
More information about the Zope3-users
mailing list