[Zope] using a dictionary returned from an external method

2000-10-24 Thread Matthew Wilbert

I have some DTML that needs to call an external method that returns a dictionary.  I 
don't have any problem referencing the resulting dictionary by doing something like

dtml-var externalMethod()['key1']
dtml-var externalMethod()['key2']
 .
.
 .

However, I need to do this for several keys, and I don't
want to call externalMethod several times.  Is there a
way to assign the method result to another variable, or
is it possible that DTML is smart enough not to do the
call multiple times?  Or is there some other approach
that I am not even thinking of?

Any suggestions will be greatly appreciated.

Thanks,

Matt Wilbert
[EMAIL PROTECTED]

___
Visit http://www.visto.com/info, your free web-based communications center.
Visto.com. Life on the Dot.


___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] using a dictionary returned from an external method

2000-10-24 Thread Ender

Matthew Wilbert wrote:
 
 I have some DTML that needs to call an external method that returns a dictionary.  I 
don't have any problem referencing the resulting dictionary by doing something like
 
 dtml-var externalMethod()['key1']
 dtml-var externalMethod()['key2']

 .
  .
 
 However, I need to do this for several keys, and I don't
 want to call externalMethod several times.  Is there a
 way to assign the method result to another variable, or
 is it possible that DTML is smart enough not to do the
 call multiple times?  Or is there some other approach
 that I am not even thinking of?

dtml-let mydict="externalMethod()"
dtml-var "mydict['key1']"
/dtml-let

i know dtml will cache results on the same method call in a single
request which generally makes it efficient to do stuff like

dtml-if expensiveQuery
dtml-var expensiveQuery
dtml-else
cheap skate;)
/dtml-if

and i'm guessing the same should apply to external methods.

kapil

___
Zope maillist  -  [EMAIL PROTECTED]
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 )