[Zope-dev] ZPatterns Design Issue
Phillip J. Eby
pje@telecommunity.com
Tue, 24 Apr 2001 17:37:53 -0400
At 05:26 PM 4/24/01 +0200, Roch'e Compaan wrote:
>How do you bind a SQL Result with multiple records with multiple instances
>of the class? Can you do this in Skinscript? Or do you mean I should return
>the sql result directly?
Just return the result directly. If the data is all from SQL, that's all
you need to do. The catch is that you may have to structure your ZClass
differently to allow it to be returned from an SQL method.
The simplest thing, though, is to define your application API's so that
methods which must return multiple objects in this fashion are returning
sequences of simple "data" objects which do not provide the full semantics
of the real objects. In essence, define the API as returning "reporting
data" rather than objects. This is similar to the ZCatalog approach which
returns dumb record objects, but can optionally retrieve the real object if
needed. It is generally the best approach for report-like situations (such
as use of the tree tag).