[Zope] zope: accessing zsql methods from external methods (1.10.2 and 1.11pr1)

Dr. Ross Lazarus rossl@med.usyd.edu.au
Mon, 10 May 1999 10:09:41 +1000


I'm stumped. 

I need a simple example of how to get an external python method to grok
a working zsql query. 

I have a zsql query which works fine, called showcont, returning the
entire contents of a small table.

I have a simple external method based on the hint on page 11 of the zsql
methods user's guide which implies that an external method should get
something useful back from showcont() - I've stripped it to the basics
so I expect to get some horrible but familiar text back without adding
any python complications - I just want this to work !!!

===========testzsql.py in Extensions directory
# testing external methods
def test(self):
     s = ''
     for cont in showcont():
          for contitem in cont:
               s = s + contitem + '<BR>'        
     return s
=========
The external method is loaded into the same folder as the zsql method
and function test is called as testzsql.

I put a <!--#var testzsql--> into a dtml method and get...tracebacks.
Basically, they all point to the fourth line - the showcont() call seems
to break. This doesn't seem to work for 1.10.2 or 1.11pr1 - both running
under nt4/sp4 using the simple server. At least I get better error
messages from the fixed externalmethods in 1.11...


Any advice appreciated !





-- 

Dr Ross Lazarus
Associate Professor and Sub-Dean for Information Technology
Faculty of Medicine, Room 126A, A27, University of Sydney,
Camperdown, NSW 2006, Australia
Tel: (+61 2) 93514429   Mobile: +61414872482
Fax: (+61 2) 93516646   Email: rossl@med.usyd.edu.au
http://www.health.usyd.edu.au/people/rossl.htm