Noob question on ZClass add script
I was trying to modify the standard add form and the NewZClass_add python script so that my newly instantiated ZClass would use the properties in my more verbose add form (standard only has object id). I have: # Add a new instance of the ZClass request = context.REQUEST instance = container.LinkFolderClass.createInObjectManager(request['id'], request) instance.manage_changeProperties(title=request['myFolder_title']) instance.manage_changeProperties(LinkFolderByline=request['myFolder_Byline']) instance.manage_changeProperties(LinkFolderText=request['myFolder_Text']) But this doesn't seem to change the properties of my new ZClass instance, but instead changes the title property of its container. Obviously this is the wrong way. What's the right way? -- Jon
Jon Fox wrote at 2003-9-17 01:36 -0400:
I was trying to modify the standard add form and the NewZClass_add python script so that my newly instantiated ZClass would use the properties in my more verbose add form (standard only has object id).
I have:
# Add a new instance of the ZClass request = context.REQUEST instance = container.LinkFolderClass.createInObjectManager(request['id'], request)
instance.manage_changeProperties(title=request['myFolder_title']) instance.manage_changeProperties(LinkFolderByline=request['myFolder_Byline']) instance.manage_changeProperties(LinkFolderText=request['myFolder_Text'])
But this doesn't seem to change the properties of my new ZClass instance, but instead changes the title property of its container.
Obviously this is the wrong way. What's the right way?
ZClass properties are usually managed in separate "PropertySheets". You must use the "PropertySheets" API (very similar to the "PropertyManager" API) to change them. It will look somehow like: instance.propertysheets.<sheetname>.manage_changePropeties(...) Dieter
participants (2)
-
Dieter Maurer -
Jon Fox