[Zope] Updating ZClass instance properties

Kevin Dangoor kid@kendermedia.com
Sun, 24 Oct 1999 16:34:31 -0400


-----Original Message-----
From: Alexandre Ratti <ratti@dial.oleane.com>
To: zope@zope.org <zope@zope.org>
Date: Sunday, October 24, 1999 4:21 PM
Subject: [Zope] Updating ZClass instance properties


>I'm trying to update the properties of a ZClass instance based on
>information entered in a form. The form calls a method where the updating
>is carried out.
>
>The updating code looks like this:
>
><dtml-with "myObject">
>  <dtml-call
>"propertysheets.InstanceConstants.manage_changeProperties(REQUEST)">
>  <dtml-call reindex_object>
></dtml-with>

Assuming that your update method is a method of the ZClass (ie it is on the
ZClass Methods tab and you can access it by going to
http://yoursite.com/Instance/Method), then you don't need to do a dtml-with.
Since you're calling the method on the instance object specifically, Zope
knows which object you're trying to use. So, assuming your propertysheet is
called InstanceConstants, then all you need to do is:

<dtml-call
"propertysheets.InstanceConstants.manage_changeProperties(REQUEST)">
<dtml-call reindex_object>

The REQUEST['id'] thing is just used when you're adding the object in the
first place, because at that time you need to define the id for the new
object. Since methods are invoked on specific objects, you don't need to
specify the id.

Kevin