Appologies - forgot to change the subject line so this is offtopic for the thread - ignore and I'll repost. Duane On Tue, 5 Oct 2004 13:35:44 +0100, Duane Raymond <duane.raymond@gmail.com> wrote:
Hi,
I'm trying to create a generic python script in Zope that will translate any SQL query into a dictionary. I've got it working when I put in the name of a specifc SQL query name, but I can't figure out the syntax/function to take a string that contains the ZSQL method name and use it in the code like I have below (which produces attribute errors):
columns=2 # the number of columns needed query = "sql_getMySQL()" myObject = getattr(context,query)
qresults=context.myObject.dictionaries() # this is done to get a real list
return [qresults[index:index+columns] for index in range(0,len(qresults),columns)]
Any suggestions?
Duane