[Zope] title property bug (zope 2.5.0)

Dieter Maurer dieter@handshake.de
Mon, 4 Feb 2002 23:14:36 +0100


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