[Zope] Zope folder property manipulation problem

Casey Duncan cduncan@kaivo.com
Fri, 25 May 2001 13:59:54 -0600


Bobby Mathew wrote:
> 
> Hi guys
> 
> I am struggling with a small part. I passed the following parameter to this
> python script - fname, newvar, newval, newtype
> I am trying to change the current variable say memberid which is passed
> within newvar with a newvalue say 100 which is passed in newval. But its not
> getting changed. The line indicated below has no effect
> ------------------------------------
> if container.hasProp(fname, newvar):
>   container[fname].manage_changeProperties(newvar = newval) (this line is
> suppossed to make the change - but no effect)

There is no property "newvar" which is what Zope thinks you want to
change. To pass variables as the keyword (and property name), you need
to use apply. Try this:

apply(container[fname].manage_changeProperties, (None,), {newvar:
newval})

>   print fname + '-0'
> else:
>   try:
>     container[fname].manage_addProperty(newvar, newval, newtype)
>     print 1
>   except:
>     print 0
> return printed
> -----------------------------------
> how do i make python understand that i want the value with the newvar to be
> used and to be set with the value within newval ???
> 
> please advice me. thanks
> 
> bobby
> 

hth,
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>