[Zope-dev] Return variables from a DTML Method
Tres Seaver
tseaver@digicool.com
Thu, 30 Nov 2000 22:17:46 -0500
bentzion@bellatlantic.net asked:
>
> I want to change some ZClass properties by getting return results
> from a DTML Method. Something like this: <dtml-call
> "myzclass.propertysheets.get('Basic').manage_changeProperties(dtmlM
> eth(this(),_))">. How do I get the dtmlMeth to return a Mapping?
> (or should I be doing this a different way?)
You *could* return a dictionary from a DTML method:
DTML Method 'return_dict'::
<dtml-return expr={ 'foo' : 0, 'bar' : 1 }
DTML Method 'show_dict'::
<dtml-var standard_html_header>
<h2><dtml-var title_or_id> <dtml-var document_title></h2>
<dtml-let dict=return_dict>
<p> Foo: <dtml-var "dict['foo']">
<p> Bar: <dtml-var "dict['bar']">
</dtml-let>
<dtml-var standard_html_footer>
....but I can't imaging wanting to. Try to rearrange your
stuff so that the code generating the mapping can call
'manage_changeProperties()' its own self, or else move
it to PythonScripts/PythonMethods/ExternalMethods/a Product;
you'll be glad you did.
Tres.
--
===============================================================
Tres Seaver tseaver@digicool.com
Digital Creations "Zope Dealers" http://www.zope.org