[Zope] Difference between dtml-let & dtml-in
Gabriel Genellina
gagenellina@softlab.com.ar
Wed, 23 Jan 2002 23:30:01 -0300
Hi
This piece of code works fine:
<dtml-let sql="restrictedTraverse(PathToSqlMethod)">
<dtml-in sql>
<dtml-var AnyFieldName>,
</dtml-in>
</dtml-let>
where PathToSqlMethod is a path to any SQLMethod, and AnyFieldName is a
column name in that SQLMethod.
Then, I didnt like the dtml-let, so I collapsed both lines, and wrote:
<dtml-in "restrictedTraverse(PathToSqlMethod)">
<dtml-var AnyFieldName>,
</dtml-in>
and I got a KeyError in __getitem__, Error Value: 0 (zero).
After several attempts I got the right way of doing it:
<dtml-in "restrictedTraverse(PathToSqlMethod)()">
<dtml-var AnyFieldName>,
</dtml-in>
So I need to call the SQLMethod explicitly, and then it returns a sequence
that <dtml-in> can handle (at least, this is what I guess.)
But now, I don't understand why the ()'s arent needed using <dtml-let>, and
then, why are them really necessary using <dtml-in "">.
I would expect both tags to behave similarly.
Perhaps someone can explain me the difference.
Gabriel Genellina
Softlab SRL