Hi all, It appears that even though you can delete the title property from a folder you cannot add it again. I came across this when trying to debug a duplicate property id error. Say you have called this python script from the current folder: #Delete all existing properties context.manage_delProperties(context.propertyIds()) You can then check the current folder "Properties" and indeed the title property is no longer listed. However you can't add it again: context.manage_addProperty('title', 'test property value', 'string') return This error results: Error Type: Bad Request Error Value: Invalid or duplicate property id Unfortunately I am no longer able to add a title property using the Zope management interface either. Interim workaround seems to be: never delete a folder's title property. How do people suggest I recreate the folder titles that have already been 'deleted'? BTW I've run fstest.py and the Zope database is still fine. Thanks, Adam
Adam Warner writes:
It appears that even though you can delete the title property from a folder you cannot add it again. ... context.manage_addProperty('title', 'test property value', 'string') return
This error results:
Error Type: Bad Request Error Value: Invalid or duplicate property id I can explain why this happens but fear there is no easy fix:
In order to provide default values, a class attribute is defined for "title". When you delete the property, you delete it for the given object. Of course, other objects of the same type must keep their "title" and the default value (if they did not yet define title explicitly). Thus, the deletion must not touch the class attribute "title". In order to prevent a property addition to override existing names, it checks with "getattr(self,id)". This check sees the class's title attribute and refuses to create the property title. Dieter
On Tue, 2002-02-05 at 11:14, Dieter Maurer wrote:
Adam Warner writes:
It appears that even though you can delete the title property from a folder you cannot add it again. ... context.manage_addProperty('title', 'test property value', 'string') return
This error results:
Error Type: Bad Request Error Value: Invalid or duplicate property id
I can explain why this happens but fear there is no easy fix:
Thanks for the explanation. It's a pity because being able to delete an object's properties and then update/create relevant properties would be quite efficient in some circumstances (also because manage_addProperty can't update an existing property). If there is no fix then this command seems to be taboo: context.manage_delProperties(context.propertyIds()) <snip>
In order to prevent a property addition to override existing names, it checks with "getattr(self,id)". This check sees the class's title attribute and refuses to create the property title.
So just to be clear, do you believe I will have to recreate folders (objects) where I deleted the title property? (Luckily it's no big deal) How about this for a workaround: 1. The manage_delProperties command be modified so that if the title property is listed for deletion, its value is instead made zero length (a title property still exists in the "Properties" tab of a folder). 2. manage_addProperty allows a title string to be added only if the title has a zero length string. Regards, Adam
Adam Warner writes:
... Thanks for the explanation. It's a pity because being able to delete an object's properties and then update/create relevant properties would be quite efficient in some circumstances (also because manage_addProperty can't update an existing property).
If there is no fix then this command seems to be taboo: context.manage_delProperties(context.propertyIds()) It's probably a (minor) Zope bug: "title" should be declared with mode "w" (which would prevent its deletion).
Maybe you file a collector report (<http://collector.zope.org>). Dieter
On Wed, 2002-02-06 at 10:25, Dieter Maurer wrote:
Adam Warner writes:
... Thanks for the explanation. It's a pity because being able to delete an object's properties and then update/create relevant properties would be quite efficient in some circumstances (also because manage_addProperty can't update an existing property).
If there is no fix then this command seems to be taboo: context.manage_delProperties(context.propertyIds()) It's probably a (minor) Zope bug: "title" should be declared with mode "w" (which would prevent its deletion).
Yes, my first real Zope bug :-) Virtually every other time it has turned out the bug has been between my keyboard and chair.
Maybe you file a collector report (<http://collector.zope.org>).
Done: http://collector.zope.org/Zope/197 Thanks, Adam
participants (4)
-
Adam Warner -
Dieter Maurer -
Dirk Datzert -
Lennart Regebro