Re: [Zope] Updating ZClass instance properties
-----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
Thanks Kevin for your suggestion. So far the updating method doesn't belong to the ZClass ; I'll change that because it makes more sense anyway. In the meantime, I've tried several syntactic variants with no luck. I still cannot access the class instance object from this method. I also tried <dtml-with "REQUEST._[id]"> and I get an Unauthorized error instead of my usual propertysheet-not-found error. This is strange, because I'm superuser. However, the following code works fine, thought it's kludgy ('news' is the folder name): <dtml-in "news.objectValues(['News'])"> <dtml-if "id()==REQUEST.id"> <dtml-call "propertysheets.InstanceConstants.manage_changeProperties(REQUEST)"> <dtml-call reindex_object> </dtml-if> </dtml-in> Looks like I can access the object indirectly but I cannot access it with <dtml-with REQUEST.id> or similar constructs. Cheers. Alexandre At 16:34 24/10/1999 -0400, Kevin Dangoor wrote:
-----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
participants (2)
-
Alexandre Ratti -
Kevin Dangoor