[Zope] Re: Weird ZSQL Method thing...

Michel Pelletier michel@digicool.com
Tue, 21 Mar 2000 06:41:19 -0800


Chris Withers wrote:
> 
> > ZSQL Methods create their own namespace (I don't know why).  You must
> > explicitly pass them arguments.  You can, of course, pass then entire
> 
> IMHO, this isn't true.

Yes it is.  I may not have stated it very clearly.

> I have several ZSQL methods which have named parameters.

This is different.

> It appears that they can get these parameters from REQUEST and possibly (I can't remember and
> haven't got time to check :( ) things like dtml-let and dtml-with without having to explicitly pass
> them which is why I was so surprised that dtml-in didn't work as expected.

When you call a method 'by name' (<dtml-var methodName>) then the DTML
machinery will magically try and line up any arguments to that method
with any names in the namespace.  It will do this for any kind of method
that accepts arguments, DTML Methods, SQL Method, ext methods,
PythonMethods, and methods written in python of the object this()
etc...  _However_ if that method is a SQL Method then as soon as you
enter the method any reference to <dtml-var name> in the SQL method will
NOT find the name in the previous DTML namespace.  If you want a name in
the DTML namespace to match an argument, that's a different matter all
together, and it will work, if you want to <dtml-var name> in a SQL
Method and 'name' is in the namespace of a calling DTML method, then it
won't work.

-Michel