----- Original Message ----- From: "Jaroslav Lukesh" <lukesh@seznam.cz> To: <zope@zope.org> Sent: Friday, May 05, 2006 1:02 AM Subject: [Zope] How to set property from external method or pythonscript?
HI all,
External methods and pythonscripts are fine, but I did not find how to set some property or bulk of properties to use in dtml document after calling this ext.method or pythonscript. The passing variables I was find for pythonscripts only.
If you are looking for ways to access property fields from dtml here are a few examples that may help. This was extracted from a 'quick-and-dirty' utility which loads a property field with data to create a 'legal-list' - the legal-list does not change once created (aside from some initial debugging!). If you are going to access property fields on a more frequent basis it would be better to use python scripts or external methods: --check for property field and if it does not exist create it: <dtml-if "not coup.hasProperty('provinces')"> <dtml-call "coup.manage_addProperty('provinces', '', 'string')"> </dtml-if> --update contents of the property field (in this case we are storing a pre-loading python dictionary): <dtml-call "coup.manage_changeProperties({'provinces':aDict})"> --access contents of a property field (which in this case is a python dictionary): <dtml-let etypes="coup.getProperty('provinces')"> <dtml-in "etypes.keys()" sort> <dtml-var sequence-item> - <dtml-var "etypes[_['sequence-item']]"><br> </dtml-in> </dtml-let> hth Jonathan