[Zope] Wrapping ZSQL method for XML-RPC access

Erik Myllymaki Erik Myllymaki <erik.myllymaki@starpointe.ca>
Fri, 02 Aug 2002 11:15:26 -0700


So, thanks to the archives, I see that ZSQL methods need to be wrapped to
get at them via XML-RPC. Modifying a snippet from a previous post, I got the
following Python Script:

-------Begin script-------------------
items=[]
names = context.getSalesmen().names()
for item in getSaleman():
  new_dict = {}
  k=0
  while k < len(item):
    new_dict[names[k]] = item[k]
    k=k+1
  items.append(new_dict)

return items
--------End script-----------------

this gives me what I need for the "getSalesmen" ZSQL method.

But I would like to use the script with any ZSQL Method. So,  i will need to
pass in two parameters - the first a ZSQL Method name, and the second, a
list of parameters.

Problem is, I don't know how I would go about building and executing the
statement:

 for item in getSalemen():

if all I have is the string "getSalesmen" ?

exec(), eval() ...

TIA