Hello all, I am trying to edit an instance of a ZClass to update the title. I am using the dtml- <dtml-call "doc.propertysheets.Basic.manage_changeProperties(REQUEST)"> where this is in the submit form of a HTML form, with "title" as a field. This will update all properties except the title. I have l also tried directly updating it by calling <dtml-call "doc.propertysheets.Basic.manage_changeProperties(title=new_title)"> I have tried trapping exceptions, and neither of these calls raise one. So does anybody know what's the deal? Sherman
<dtml-call "doc.propertysheets.Basic.manage_changeProperties(REQUEST)">
Surprised anything works with this. manage_changeProperties requires that you say exactly what should be updated like you have shown below. If you don't want to say exactly which properties to update you should use manage_editProperties() which sniffs the REQUEST for existing variablenames that match what is in the basics of the ZClass. doc.propertysheets.Basic contains the id and title properties by default. Don't you have a real propertysheet instance for your ZClass? Use that one instead then to set the title and it will overwrite the basic one. Since Zope 2.3.0, <dtml-call is silent on errors. <dtml-call blablablashitbla> returns no error if it doesn't exist. <dtml-var blablablashitbla> will return a KeyError though. Use <dtml-var for debugging. peter
where this is in the submit form of a HTML form, with "title" as a field. This will update all properties except the title. I have l also tried directly updating it by calling <dtml-call "doc.propertysheets.Basic.manage_changeProperties(title=new_title)"> I have tried trapping exceptions, and neither of these calls raise one. So does anybody know what's the deal?
Sherman
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
I am having the same problem - I have an instance of a zclass that I need to update only a couple of the properties of, not all of them. The basic idea is that the user checks a checkbox saying I want to update this property and also some checkboxes for each of the instances that they want to update. My dtml document runs through each of the instances selected and then tries to update the selected properties - however, as the previous email I am getting no change of the properties! I do not want to use the catch all of using the REQUEST object and editProperties.. as there are fields on the form which don't need to be updated. Here is my dtml code.. <dtml-in "REQUEST.form.values()"> <dtml-if "_.str(_['sequence-item'])[:9]=='Specimen_'"> <dtml-call "REQUEST.set('specimen',_['sequence-item'])"> <---This is the name/id of the object I need to update <dtml-in chkbox> <dtml-call "REQUEST.set('keyvalue',_[_['sequence-item']])"> <---This is the name of the property <dtml-call "REQUEST.set('keyname',_['sequence-item'])"> <---This is the new value of the property <dtml-call expr="_.getitem(specimen).propertysheets.Basic.manage_changeProperties(keyna me=keyvalue)"> </dtml-in> </dtml-if> </dtml-in> Other things I have tried (unsuccesfully of course!): If I change the dtml-call to dtml-var and it returns none - no mention of an error If I try to use dtml-with "_.getitem(specimen)" but still it doesn't change the property Laurie Any ideas as to how I can do this -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Sherman Lambert (State Public Defenders Office) Sent: Tuesday, July 03, 2001 9:19 AM To: zope@zope.org Subject: [Zope] Updating Zclass object titles Hello all, I am trying to edit an instance of a ZClass to update the title. I am using the dtml- <dtml-call "doc.propertysheets.Basic.manage_changeProperties(REQUEST)"> where this is in the submit form of a HTML form, with "title" as a field. This will update all properties except the title. I have l also tried directly updating it by calling <dtml-call "doc.propertysheets.Basic.manage_changeProperties(title=new_title)"> I have tried trapping exceptions, and neither of these calls raise one. So does anybody know what's the deal? Sherman _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
OK Found the solution - with a lot of digging in mailing lists...! change this <dtml-call expr="_.getitem(specimen).propertysheets.Basic.manage_changeProperties(keyna me=keyvalue)"> to <dtml-call expr="_.getitem(specimen).propertysheets.Basic.manage_changeProperties({keyn ame:keyvalue})"> and it appears to work as it should! Laurie -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Laurie Nason Sent: Tuesday, July 03, 2001 10:43 AM To: sherman.lambert@state.co.us; zope@zope.org Subject: RE: [Zope] Updating Zclass object titles I am having the same problem - I have an instance of a zclass that I need to update only a couple of the properties of, not all of them. The basic idea is that the user checks a checkbox saying I want to update this property and also some checkboxes for each of the instances that they want to update. My dtml document runs through each of the instances selected and then tries to update the selected properties - however, as the previous email I am getting no change of the properties! I do not want to use the catch all of using the REQUEST object and editProperties.. as there are fields on the form which don't need to be updated. Here is my dtml code.. <dtml-in "REQUEST.form.values()"> <dtml-if "_.str(_['sequence-item'])[:9]=='Specimen_'"> <dtml-call "REQUEST.set('specimen',_['sequence-item'])"> <---This is the name/id of the object I need to update <dtml-in chkbox> <dtml-call "REQUEST.set('keyvalue',_[_['sequence-item']])"> <---This is the name of the property <dtml-call "REQUEST.set('keyname',_['sequence-item'])"> <---This is the new value of the property <dtml-call expr="_.getitem(specimen).propertysheets.Basic.manage_changeProperties(keyna me=keyvalue)"> </dtml-in> </dtml-if> </dtml-in> Other things I have tried (unsuccesfully of course!): If I change the dtml-call to dtml-var and it returns none - no mention of an error If I try to use dtml-with "_.getitem(specimen)" but still it doesn't change the property Laurie Any ideas as to how I can do this -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Sherman Lambert (State Public Defenders Office) Sent: Tuesday, July 03, 2001 9:19 AM To: zope@zope.org Subject: [Zope] Updating Zclass object titles Hello all, I am trying to edit an instance of a ZClass to update the title. I am using the dtml- <dtml-call "doc.propertysheets.Basic.manage_changeProperties(REQUEST)"> where this is in the submit form of a HTML form, with "title" as a field. This will update all properties except the title. I have l also tried directly updating it by calling <dtml-call "doc.propertysheets.Basic.manage_changeProperties(title=new_title)"> I have tried trapping exceptions, and neither of these calls raise one. So does anybody know what's the deal? Sherman _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev ) _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Laurie Nason -
Peter Bengtsson -
Sherman Lambert (State Public Defenders Office)