[Zope] zopectl debug question

Duane Raymond duane.raymond at gmail.com
Tue Oct 5 08:35:44 EDT 2004


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


More information about the Zope mailing list