[Zope] Newbie to Zope

Joel Burton joel@joelburton.com
Fri, 26 Jul 2002 09:14:34 -0400


This is a multi-part message in MIME format.

------=_NextPart_000_002D_01C23484.DBC6EE10
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of zope
Sent: Thursday, July 25, 2002 11:26 PM
To: zope@zope.org
Subject: [Zope] Newbie to Zope


Hi

I am a Newbie to zope.
I am interested in working in zope and have been involved in work related
with Pythonscripts and PostgreSql and Page Templates.
I have become stuck at a point and I am not able to find what to do next.
I am using a python Script to run a ZSQL method and then the values are to
be sent to the Page Template to be displayed.The Script is:

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
Am i not being able to get the record set from the database?Because if I
give a print command in the loop it does not work.HEnce it may not be
entering the loop.What is the method to access a Zsql Method which is
another folder?
If there is someone who could help me out here it would be very
helpful.Since i am stuck with this problem for 2 days and I have tried other
possibilities.

John --

You have *call* the ZSQLMethod, which you're not doing. You're just
referencing it.

Try:

r = context.ond.db.zqll_clin()   (note the parens for the call at the end)

BTW, why are you going from ZSQLMethod -> PythonScript -> PageTemplate? In
most cases, the ZSQLMethod returns data that you can just iterate over and
display directly in the PageTemplate; in cases where you want to clean up
the data, using a PluggableBrain is usually a cleaner option than iterating
and creating a new list in a PythonScript. Search the list or The Zope Book
for info on PluggableBrains.

- J.


------=_NextPart_000_002D_01C23484.DBC6EE10
Content-Type: text/x-vcard;
	name="Joel Burton.vcf"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="Joel Burton.vcf"

BEGIN:VCARD
VERSION:2.1
N:Burton;Joel
FN:Joel Burton
ORG:Joel Burton & Associates
TITLE:Principal
TEL;WORK;VOICE:(202) 483-7168
TEL;HOME;VOICE:(202) 483-7168
TEL;CELL;VOICE:(202) 251-4877
ADR;WORK:;;1705 P St NW #43;Washington;DC;20036;United States of America
LABEL;WORK;ENCODING=3DQUOTED-PRINTABLE:1705 P St NW =
#43=3D0D=3D0AWashington, DC 20036=3D0D=3D0AUnited States of America
ADR;HOME:;;1705 P St NW #43;Washington;DC;20036;United States of America
LABEL;HOME;ENCODING=3DQUOTED-PRINTABLE:1705 P St NW =
#43=3D0D=3D0AWashington, DC 20036=3D0D=3D0AUnited States of America
URL;WORK:http://joelburton.com
ROLE:Information Technology
BDAY:19721012
EMAIL;PREF;INTERNET:joel@joelburton.com
REV:20011203T044543Z
END:VCARD

------=_NextPart_000_002D_01C23484.DBC6EE10--