[Zope] Probably a simple name space question

Dieter Maurer dieter@handshake.de
Wed, 21 Jun 2000 22:33:30 +0200 (CEST)


Bert Jan Bakker writes:
 > I want to call a Z SQL Method (say InsertFoo)
 > from a DTML Method (say CallingInsertFoo) and 
 > it just won't work.
 > 
 > The Z SQL Method takes three arguments, let's
 > call them a_id, b_id and c_id.
 > 
 > All three arguments are available to me
 > in the calling DTML Method. I can print
 > them in HTML. But when I call the query
 > with <dtml-var InsertFoo> I get the following
 > error:
 > 
 > "Error Type: Bad Request
 >  Error Value: ['a_id', 'b_id', 'c_id']"
This problem seems to come up once in every few weaks --> an FAQ.

Okay, again:

  ZSQL methods are stupid, in that they only look at
  the REQUEST object and not at the namespace to find
  their arguments.


You could avoid this weakness by:

 1. <dtml-var "InsertFoo(a_id=a_id, b_id=b_id, c_id=c_id)">

    This provides the arguments explicitely.

 2. <dtml-call "REQUEST.set('a_id',a_id)">
    ....
    <dtml-call "REQUEST.set('c_id',c_id)">
    <dtml-var InsertFoo>

    This puts the argument values into the REQUEST object.



Dieter