[Zope3-Users] Object-deleted-events
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 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Object-deleted-events
Le lundi 07 janvier 2008 à 14:30 +0100, Tobias Rodäbel a écrit : 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. Hi, Maybe I'm wrong, but I thing that '__del__' destructor is not called when an object is removed from it's container, but when it's references count in Python interpretor is decremented to 0. For your use case, the only thing you should do is just to implement a subscriber to IObjectRemovedEvent (defined into zope.app.container.interfaces) which is automatically fired by all standard Zope3 containers. Hope this helps, Thierry Florac -- Chef de projet intranet/internet Office National des Forêts - Département Informatique 2, Avenue de Saint-Mandé 75570 PARIS Cedex 12 Mél : [EMAIL PROTECTED] Tél. : +33 01.40.19.59.64 Fax. : +33 01.40.19.59.85 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Object-deleted-events
Hi Thierry, On Jan 7, 2008, at 4:44 PM, Thierry Florac wrote: For your use case, the only thing you should do is just to implement a subscriber to IObjectRemovedEvent (defined into zope.app.container.interfaces) which is automatically fired by all standard Zope3 containers. Hope this helps, Thank you very much! Works well. Now I know why I didn't find any IObjectDeletedEvent before ;-) Tobias ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] Vocabulary, unicode
SimpleTerm of zope.schema does not allow tokens to be unicode. Why this? ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Vocabulary, unicode
Hallo Katja, I would say that's because tokens are used in the widgets for item identification. Usual business is to utf-8 and base64 encode unicode tokens. Monday, January 7, 2008, 5:35:46 PM, you wrote: KS SimpleTerm of zope.schema does not allow tokens to be unicode. Why this? KS ___ KS Zope3-users mailing list KS Zope3-users@zope.org KS http://mail.zope.org/mailman/listinfo/zope3-users -- Best regards, Adam Groszermailto:[EMAIL PROTECTED] -- Quote of the day: Not only is there no God, but try getting a plumber on the weekend. - Woody Allan ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] Vocabulary, unicode
On Jan 7, 2008 5:35 PM, Katja Süss [EMAIL PROTECTED] wrote: SimpleTerm of zope.schema does not allow tokens to be unicode. Why this? Because tokens need to be round-trippable in browsers, without encountering encoding issues. Tokens are internal values, unique in the set, whatever they may represent. -- Martijn Pieters ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users