[Zope] Passing arguments with hyperlinks

Shai Berger shai@aristocart.com
Tue, 07 Aug 2001 11:48:54 +0300


> > Even easier: <dtml-in myZSQLMethod>
> >
> > The namespace-passing stuff all works automatically as long as you have
> > "teamid" in the parameter list of the ZSQL method ...
> 
> That would make sense, but I seem to recall having problems with this in the
> past.  Maybe I'm thinking of some other case.

Yes, if you try to call the same method later by defining
the teamid (or any other argument) in DTML (be it through
<dtml-let>, <dtml-in>, <dtml-with> or whatever) it will
fail. The namespace-passing works only for variables
in REQUEST. I took me quite some time to realise all the 
intricacies of it, with the help Dieter Maurer. A set of
other wierdness happens inside the ZSQL Method: The DTML
namespace inside is copied from REQUEST, rather than
including request as in DTML Methods and Documents. This
means that while the only variables recognized in the
ZSQL Method are those defined in the REQUEST before entry,
<dtml-call "REQUEST.set('var',value)"> does not make var
available to dtml (other than "REQUEST.get('var')", of course).
This behavior is surprising, IMHO bordering on broken, 
but that's how it stands.

You can make the namespace-passing work as you expect with
<dtml-in "myZSQLMethod(_)">. This fix has been mentioned in
many places, including ZB, I think, but this still catches
people unaware every time.

Have fun,
	Shai.