[Zope] manage_changeProperties from Python, using ZClass instance locatedthrough ZCatalog

Milos Prudek milos.prudek@tiscali.cz
Wed, 26 Sep 2001 13:21:00 +0200


> A catalog search does not return the true object but
> only the meta data remembered for the object at
> cataloging time.

Very true.

> When you work with Zope 2.3.3 or later, the
> catalog result has a method "getobject" (or something similar)

Yes indeed. 

Based on your information, the following Python Script works great. It
searches for a ZClass instance with title="aaa" and it changes the m_id
property.

rid=context.Catalog_Org(title="aaa")[0].data_record_id_
a=context.Catalog_Org.getobject(rid)
print repr(a.propertysheets.data.m_id)
a.propertysheets.data.manage_changeProperties(m_id=[111,222,333])
a.reindex_object()
print repr(a.propertysheets.data.m_id)

return printed

> 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.

It does change, actually. The two lines "print
repr(a.propertysheets.data.m_id)" prove it.

Thank you very much, Dieter. The information you gave me is actually
written in the Zope Book Appendix B, and it is my fault that I did not
notice it. I'm going to study Appendix B more thoroughly.

--
Milos Prudek