[Zope] Surprises with dtml-in and dtml-with

Shai Berger shai@aristocart.com
Thu, 05 Apr 2001 00:37:35 +0200


Hi Guys,

I found a very peculiar behvaior in the interaction
between dtml-with and dtml-in. I have two queries,
QueryA and QueryB, which have common columns. I have
a method Method1 in Folder1, which does

<dtml-in QueryA>
 <dtml-with Folder2>
  <dtml-call Method2>
 </dtml-with>
</dtml-in>

And Method2 in Folder2, which does

<dtml-with Folder1>
 <dtml-in QueryB>
  <dtml-with Folder3>
   ...access common fields...
  </dtml-with>
 </dtml-in>
</dtml-with>

(QueryA and QueryB are in fact two invocations of the
same ZSQL method, defined in Folder1, with diferrent
arguments. It is a complex queries, and with different
arguments it returns different columns).

Now, to my surprise, it turns out that when common fields
are accessed as shown above, QueryA takes precedence. To
my even greater surprise, it turns out that the quack-medicine
of interchanging the dtml-with and dtml-in in Method2, i.e.
making it read 

<dtml-with Folder1>
  <dtml-with Folder3>
 <dtml-in QueryB>
   ...access common fields...
 </dtml-in>
  </dtml-with>
</dtml-with>

Restores predicted behavior (i.e. QueryB results take precedence).

Has anyone seen behavior like this? Can anyone explain it?

Thanks,
	Shai.