[Zope] newbie: call dtml-method with parameter sequence-item

Dieter Maurer dieter@handshake.de
Thu, 7 Jun 2001 22:14:35 +0200 (CEST)


Horst Wald writes:
 > loop in a DTML-document with "sequence-item" as a parameter? Of course you 
 > can't
 > <dtml-in "_.range(10)">
 >   <dtml-call "Z(<dtml-var sequence-item>)">
 > </dtml-in>
 > because you'd have to nest one dtml-tag in another. But what can you do?
 > I guess the trick is simple, but I can't find it...
Z SQL Methods accept only a single positional argument (which must
be a mapping with "get" method) exclusive or a set of keyword parameters.
Your "sequence-item" is probably not a mapping, thus you would need
something like:

	  <dtml-call "Z(xxx=_['sequence-item'])">

Are you sure, you want to discard the return value?
If not, you would need "dtml-var" rather than "dtml-call".

Personally, I prefer the introduction of a new variable
to avoid the "_[...]" syntax:

	 <dtml-let current=sequence-item>
	   <dtml-call "Z(xxx=current)">
	 </dtml-let>


Dieter