[Zope] Using string as object name?

Dieter Maurer dieter at handshake.de
Tue Oct 5 15:00:01 EDT 2004


Duane Raymond wrote at 2004-10-5 13:38 +0100:
> ...
>columns=2 # the number of columns needed
>query = "sql_getMySQL()"
>myObject = getattr(context,query)

Try:

	query = "sql_getMySQL"
	myObject = getattr(context, query) # this is the Z SQL Method
	#
	result = myObject() # this calls it

-- 
Dieter


More information about the Zope mailing list