[Zope] question on setting PropertySheet value from External Method -- solved
Tim Lynch
lynch@gould.mannlib.cornell.edu
Fri, 14 Dec 2001 12:56:11 EST
Got it.
I had poured over the list archives without finding the magic incantation before
posting my plea to the list. Finally, this afternoon while poking around Zope Labs
I came across a recipe that got me to:
self.resources[recordID].propertysheets.Basic.manage_changeProperties({'Title':t})
which works.
Much thanks to 'peterbe' and his/her message of 2001-08-08.
- lynch
> Hi,
>
> I'm having trouble setting a property of a ZClass propertysheet from
> an external method. I can successfully create an instance of the ZClass and
> from a DTML document set the properties, but I can't seem to get the syntax
> right for doing it from the external method. Could someone give me some advice?
>
> Here are the relevant lines from my external method that successfully creates the
> ZClass instance:
>
> recordID = "7893"
> t = "A new title"
>
> self.resources.manage_addProduct['agnicCatalog'].resourceClass.createInObjectManager(recordID, self.REQUEST)
>
>
> I have a folder called 'resources' that I want to hold all instances of the class 'resourceClass'.
> The above line works fine to create the instance.
>
> But, when I try to change the Title property with:
>
> self.resources[recordID].propertysheets['Basic'].manage_changeProperties(Title = t)
>
> I get TypeError -- sequence index must be integer
>
> I've tried a bunch of variations with recordID, but nothing seems to work.
>
> Can someone set me straight? Thanks!
>
> ============================================================================
> Tim Lynch tim.lynch@cornell.edu
> Mann Library 607.255.9570
> Cornell University
> Ithaca, NY 14853