[Zope-dev] More ZSQL weirdness (this time with Python Scripts ;-)

Dieter Maurer dieter@handshake.de
Thu, 22 Mar 2001 21:03:58 +0100 (CET)


Chris Withers writes:
 > I had the following line in a dtml method, x_report, generated by 'Add Z Search
 > Interface':
 > <dtml-in x>
 > 
 > ....where x is a ZSQL Method that takes one parameter: sec
 > 
 > Now, when I try to call x_report from a python script, my_ps, as follows:
 > 
 > return container.x_report(context,context.REQUEST,sec='XXX')
 > 
 > ....I get the following:
 > 
 > Error Type: Bad Request
 > Error Value: ['sec']
This is an old one....

  ZSQL method's do not use the DTML namespace (where you "sec" goes to)
  to find their arguments:

  The prototype is as follows:

     def __call__(self, REQUEST=None, __ick__=None, src__=0, test__=0, **kw)
    
  If the second parameter (REQUEST) is passed, it should be a
  dictionary and it is used to find the parameters.

  Otherwise, if keywords arguments are provided, the keyword dict
  is used.

  Otherwise, "REQUEST" is obtained by acquisition and used.

  Otherwise, "{}" is used.


In the future, Z SQL methods may perhaps use the new "namespace" passing
mechanism (feature request for the Locator?). But currently,
they behave as said above.


Dieter