[Zope] title property bug (zope 2.5.0)

Adam Warner lists@consulting.net.nz
05 Feb 2002 12:42:33 +1300


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