[Zope] Z SQL method results from a python script

daniel.a.fulton@delphiauto.com daniel.a.fulton@delphiauto.com
Fri, 18 May 2001 08:44:14 +0800


I have a Z SQL method named "employ_data" as below:

          SELECT SUM(employ_hour) AS sum_hour, SUM(employ_salary+employ_hour) AS
sum_total, division
                          WHERE employ_record.month=<dtml-sqlvar month
type=string>
                          AND employ_record.year=<dtml-sqlvar year type=int>
                         GROUP BY division

This method has been tested and returns multiple rows in the result set
correctly with input for month, year.

I want to use this method in a python script but can't for the life of me get it
to return the entire result set.

Python script:

           results = context.employ_data(month=month, year=year)

           for result in results:
                        return result.sum_hour, result.sum_total,
result.division

This returns only one record -- the first record in the result set.   I need the
entire result set.

Am I misusing this or have incorrect script?

Thanks,
Daniel