[Zope] ZSqlMethod and Brain Class

Dieter Maurer dieter@handshake.de
Sun, 14 Apr 2002 23:33:00 +0200


Delarue Christophe writes:
 > ....
 > Done
 > ---
 > ref
 > correction 
 > 
 > ...
 > Thus I choose to associate a Brain Class to SQLQuery in which I use a
 > ZSqlMethod SQLQueryDone which retrieve the full content of the Done table for a
 > given ref.
 > 
 > class Result:
 >    def treat(self):
 >        return self.SQLQueryDone(Ref=self.Ref)
 > 
 > In the EditRef I've written :
 > <dtml-if treat>
 >   <dtml-with treat>
 >     <dtml-var correction>
 >   </dtml-with>
 > </dtml-if>
 > 
 > If execute the query, I've got an Error :
 > 
 >             Error Type: KeyError
 >             Error Value: correction
"treat" returns a sequence of "Done" records. While a single
"Done" record has a "correction" attribute, the sequence does
not.

Try: '<dtml-with expr="treat[0]">' ....


Dieter