Delete the properties and propertysheet defined by ZClass
Hi, all On my migration of Zope system, the one of ZClass common propertysheets has stopped using. So, first I just simply delete the definition of this propertysheet on ZClass, but namespace of existing ZClass instances seem to be polluted by old properties which were defined by that propertysheet. Second, get back that propertysheet definition using undo, then I try to delete the properties and propertysheet on each ZClass instance using manage_delProperties() and delPropertySheet(). but it was failed. Does anybody have any idea to clean up properties and propertysheet on ZClass instance? The version of Zope is 2.5.1 . Thanks in advance. --- kaz
Takakazu Tamaki wrote at 2004-9-20 21:05 +0900:
On my migration of Zope system, the one of ZClass common propertysheets has stopped using. So, first I just simply delete the definition of this propertysheet on ZClass, but namespace of existing ZClass instances seem to be polluted by old properties which were defined by that propertysheet.
The property definitions (names, types, default values) live in the property sheet; instance specific property values live as attributes on the respective instance. This means, you must make a script that visits your instances and deletes all attributes that correspond to a deleted property. Something like: for pn in yourSheet.propertyIds(): try: delattr(obj, pn) except AttributeError: pass After that you can delete the property sheets themthelves. -- Dieter
Hi, Dieter According to the docs in the /OFS/PropertySheets.py and /ZCasses/Property.py, you gave me the right answer. :) Thanx. On Mon, 20 Sep 2004 19:16:26 +0200 Dieter Maurer <dieter@handshake.de> wrote:
The property definitions (names, types, default values) live in the property sheet; instance specific property values live as attributes on the respective instance.
This means, you must make a script that visits your instances and deletes all attributes that correspond to a deleted property. Something like:
for pn in yourSheet.propertyIds(): try: delattr(obj, pn) except AttributeError: pass
After that you can delete the property sheets themthelves.
--- kaz
participants (2)
-
Dieter Maurer -
Takakazu Tamaki