[Zope] how to modify floder's attribute by script

nienfeng nienfeng at multisuns.com.tw
Wed Dec 27 05:21:17 EST 2006



nienfeng :

>
> I create a folder in ZMI, and add several attributes in it.
> In the folder, I add a Script that modify the folder's attribute.
> How should I do?
>

I find it : manage_changeProperties()
but There are still something I don't know.

EX:
    Email/ (folder), has 3 properties: mTo, mFrom, mCC
          MailHost(Mailhost)
          set (Script Python)

    in set:
## Script (Python) "set"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=      

print container.propertyItems()
# output:  [('title', ''), ('mTo', 'nienfeng@'), ('mFrom', 'nienfeng@'), 
('mCC', '')]
print container['MailHost'].propertyItems()
# output: still as same as above
print container['MailHost']
# output <MailHost at MailHost>

container.manage_changeProperties(mTo='testTo')
# It work
container['MailHost'].manage_changeProperties(smtp_host='testHost')
# It don't work and have not any ErrorMessage

 What's wrong with the container['MailHost'].propertyItems()  and  
container['MailHost'].manage_changeProperties(smtp_host='testHost')

Thanks. 
by nienfeng


More information about the Zope mailing list