[Zope] Newbie to Zope

Mike Renfro renfro@tntech.edu
Fri, 26 Jul 2002 08:10:43 -0500


On Fri, Jul 26, 2002 at 08:56:07AM +0530, zope wrote:

> from Products.PythonScripts.standard import html_quote
> r = context.ond.db.zqll_clin    # this is a zsql method in a different folder at root 
> for x in r:
>    print x['Id'],x['Name'],x['tt']   # these are the fields of the table 
> return r

> The error message I get is
> Error Type: KeyError
> Error Value: 0

Just a guess, but what happens if you change the script to just:

  r=context.ond.db.zqll_clin
  print r

? If you get a result something like "<ZSQL Method at 0xfd234908ce>",
then you're not actually calling the method, and just referencing
it. If that's the case, try changing the lines to:

  r=context.ond.db.zqll_clin()
  print r

and see if you get a list back. If that works, then you should be
ready to tackle the loop.

-- 
Mike Renfro  / R&D Engineer, Center for Manufacturing Research,
931 372-3601 / Tennessee Technological University -- renfro@tntech.edu