[Zope] manage_changeProperties from Python, using ZClass instance located through ZCatalog

Milos Prudek milos.prudek@tiscali.cz
Tue, 25 Sep 2001 19:37:20 +0200


> However, the following script does not change the value of m_id
> property. It runs as if everything is ok. It finds correct instance
> 
> x=context.Catalog_Org(title="aaa")
> print x[0].m_id
> print x[0].title
> new_m_id=[999,888,777]
> x[0].manage_changeProperties(m_id=new_m_id)
> print x[0].m_id

OK, that was stupid of me. "x" is metadata, not an instance. I need to
run the manage_changeProperties on the instance. But how can I construct
this call? I know the title of the instance, and I can find the id of
the instance...

In Python Script:
new_m_id=[999,888,777]
stored_id=context.Catalog(title=stored_title)[0].id

Now I need to call manage_changeProperies on that instance from that
Python Script. Ideas:
context.REQUEST.RESPONSE.redirect(my_id+"/change_m_id?+"new_m_id")

I would have to write a dtml method "change_m_id" that call
"manage_changeProperties" with parameter "new_m_id". But it would mean
passing this parameter in the URL. Not very secure.

Please note that "id" is an id of the ZClass instance, but m_id is a
property (in propertysheets) of that instance, and its type is tokens
(list).

Any ideas, please?

--
Milos Prudek