Change properties -> auto-update
I've created a product with a zClass that has a couple of property sheets. Users can place this product in their web hierarchy and edit properties with the Properties tab. This all works just fine. The problem is that modifying one of the properties needs to have a side effect. I would like to update a database if this property is changed. Is there an easy way to hook into this process so I can set up a side-effect script? The default propertysheets/Basic/manage page posts the results to propertysheet/Basic, but I'm fuzzy on how (or if) you can change the processing of this script. I suppose I could replace the page that displays the properties and have it submit the changes to a custom script, but I'm not exactly crazy about that idea. The downside of that route is that hardcoding the template page with one of my own will lose me the flexibility I have now. If I add a new property, I'll have to remember to add it to the template. Or does anyone know where I can find the current template that dynamically shows the property form, so I can make a modified version for this product? Gre7g
Gre7g Luterman wrote at 2005-3-18 12:23 -0700:
I've created a product with a zClass that has a couple of property sheets. Users can place this product in their web hierarchy and edit properties with the Properties tab. This all works just fine.
The problem is that modifying one of the properties needs to have a side effect. I would like to update a database if this property is changed. Is there an easy way to hook into this process so I can set up a side-effect script?
There is no built in hook for this. The easiest (though not necessary the clearest) way would be to use a monkey patch (see Zope.org) to change the "PropertySheet"s "manage_changeProperties" and "manage_editProperties".
The default propertysheets/Basic/manage page posts the results to propertysheet/Basic, but I'm fuzzy on how (or if) you can change the processing of this script.
Almost surely, it calls "propertysheet.Basic.manage_editProperties". You can replace both the form and its action and in your new action do whatever you need.... -- Dieter
participants (2)
-
Dieter Maurer -
Gre7g Luterman