[Zope] paramters to sql methods have to be in REQUEST????

Brian Lloyd Brian@digicool.com
Thu, 29 Jul 1999 07:24:29 -0400


> > "Jay, Dylan" wrote:
> > > 
> > > Why is it that
> > > 
> > >         <!--#with "_.namespace(MatchPattern=bits[0])"-->
> > >          <!--#var ChoosePart-->
> > >         <!--#/with-->
> > > 
> > > doen't work and
> > > 
> > >         <!--#call "REQUEST.set('MatchPattern',bits[0])"-->
> > >         <!--#var ChoosePart-->
> > > does??????
> > > 
> > > Is this a bug? If so can it be fixed as it is annoying.

Two things to note here: first, if you have defined 'MatchPattern'
in the 'arguments' list of the SQLMethod, you can pass it directly
as a keyword argument:

  <!--#var "ChoosePart(MatchPattern=bits[0])"-->

The reason that SQLMethods don't respect the entire namespace is
mostly to prevent unintended things from happenning (by the SQL
Method picking up and using a name from the namespace that you
really didn't intend for it to use). SQLMethods _intentionally_
force you to be a little more explicit about what variables can
be used in them - more so than DTML Methods/Documents, because
if you have a variable collision in DTML, no real harm is done.
At worst, the client sees a rendered document that doesn't make
much sense. For SQLMethods the consequences of such a thing are
are a bit worse, since you could end up inserting bad data into
your database...

Hope this helps!



Brian Lloyd        brian@digicool.com
Software Engineer  540.371.6909              
Digital Creations  http://www.digicool.com