[Zope-dev] ZPatterns Design Issue

Phillip J. Eby pje@telecommunity.com
Tue, 24 Apr 2001 10:29:57 -0400


At 03:01 PM 4/24/01 +0200, Roch'e Compaan wrote:
>Building the tree leads to a whole bunch of queries to the database that
>really slows thing down ie. besides the queries that retrieve children,
>select queries to retrieve individual instances is called by getItem through
>SkinScript for each item in the tree.

Why don't you just have the rack's getChildrenFor() method return instances 
of the correct class, with all the data filled in from the SQL 
method?  There should be no need to re-retrieve the same items with 
getItem().  Note, by the way, that this does not violate encapsulation, 
since the specialist and racks are specifically the place to put 
implementation-specific versions of multi-object methods like this.

(Btw, if anybody's compiling a ZPatterns FAQ, this should probably get in 
there.)