[Zope-DB] Newbie question: zsql result conundrum

Kevin Chambers kevin@molingo.com
Thu, 15 May 2003 20:44:23 -0700


Hi there--

I know there must be an easy way to get this.  I need to get a field data from 
a zsql method recset, where my field name is a variable.

----BEGIN------
# Example code:

field1="firstname"
recset=context.SomeQuery(request)
for rec in recset:
    print "%s: %s" % (field1, rec.firstname)
    print "%s: %s" % (field1, rec.getitem(field1))

return printed

---END----

The first "print" line will of course work, but I need the second line. 
getitem() above doesn't work, nor does getattr() or get().  What's the magic word??

Thanks in advance!

KC