[Zope] REPOST: dtml-with doesn't work

Shai Berger shai@aristocart.com
Sun, 14 Jan 2001 11:09:23 +0200


Philip has already made it clear that this was not his problem, but
still,

Dieter Maurer wrote:

> Just a remark:
> 
>   SQL methods do *NOT* look at the DTML namespace *AT ALL*,
>   just at REQUEST (or the expliciitly passed keyword arguments).
> 
>   Thus, "dtml-with", "dtml-let" and friends are all ineffective
>   with respect to ZSQL methods.
> 

My experience is somewhat different: ZSQL methods in general *DO*
look at the namespace just like normal DTML methods, with two 
exceptions:

1) The major one, is that Dieter's remark does describe (almost) 
correctly the behavior of <dtml-sqlvar> and <dtml-sqltest>. These two 
tags only look at a very limited local namespace, initialized with the
REQUEST and passed arguments; but even this namespace may be modified,
*INSIDE* the ZSQL method, with <dtml-in> and <dtml-let>. However, 
other tags behave quite normally -- which means that a lot of the
problems can be bypassed by thoughtful use of <dtml-var>, especially
using the sql_quote modifier (BTW, it is by virtue of this that you
can call other methods -- even other ZSQL methods -- from within a
ZSQL method).

2) Changing REQUEST does *not* update the local namespace, that is,
within a ZSQL method,

<dtml-call "REQUEST.set('some_var', 17)">
<dtml-var some_var>

doesn't work; but

<dtml-var "REQUEST['some_var']">

Does.

Hope this helps,

	Shai.