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

Dieter Maurer dieter@handshake.de
Tue, 25 Sep 2001 23:34:07 +0200 (CEST)


Milos Prudek writes:
 > ...
 > However, the following script does not change the value of m_id
 > property. It runs as if everything is ok. It finds correct instance
 > using "title", the x[0].m_id and x[0].title show correct values, but the
 > "line x[0].manage_changeProperties(m_id=new_m_id)" has no effect
 > whatsoever.
 > 
 > 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
A catalog search does not return the true object but
only the meta data remembered for the object at
cataloging time.

You "manage_changeProperties" probably belongs to
a the catalog (it's acquired). Because the catalog
does not have a "m_id" property (I expect), nothing happens.

When you work with Zope 2.3.3 or later, the
catalog result has a method "getobject" (or something similar)
which returns the true object and which you can use
to change the properties. If you do not recatalog, the
meta data in the catalog remain unchanged.
Even if you recatalog, I am not sure whether x[0]
magically changes its values. I expect not.


Dieter