[Zope-dev] how to add new propertys programmatically ?

Joachim Schmitz js@aixtraware.de
Wed, 29 Nov 2000 17:15:01 +0100 (CET)


Hi,

I tried to add a new property to an existing zclass-dataskin-propertysheet
programmatically with

<dtml-call "item.propertysheets.Basic.manage_addProperty(id,0,type)"> 

but that gives me
 
Zope Error
Zope has encountered an error while publishing this resource. 

Error Type: Bad Request
Error Value: Properties cannot be added to this property sheet

The reason that I want to add a new property is:

I have a folder Adress
with FieldObjects (Folders)
Firstname
Lastname
Street
and so on...

Each FieldObject has the attributes:

type, sortorder, required and others

That way I can easely add or remove FieldObjects to my Adressfolder.

Now I want to do all my processing based on the FieldObjects in the folder
and store the values in a ZPatternRack, I defined a Zclass for storage
with a propertysheet Basic defined but empty, cause I lazy I only want to
define my properties only once, by putting a FieldObject in my folder.
Than at runtime I wanted to check if a property with the name of my
FieldObject exists, and if not I want to addit, but that does not work see
above.

Is this a good idea at all ? or are there better ways to achieve this ?




Mit freundlichen Grüßen

Joachim Schmitz  

          
AixtraWare, Ing. Büro für Internetanwendungen
Hüsgenstr. 33a, D-52457 Aldenhoven  
Telefon: +49-2464-8851, FAX: +49-2464-905163