This is my first Zope usage ... I've an ODBC Connection for two tables : FA -- ref name Done --- ref correction This Done table may not have a ref entry event if FA has. To edit the FA, I've got a ZSqlMethod SQLQuery which take a `ref' as arg. I edit this by http://host/SQLQuery/Ref/3414/EditRef the EditRef is a DtmlMethod which want to display something if there is data in the Done table. 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 I suppose I've got a namespace problem. I do not understand. thank's for any help. NOTE : I've tried a SELECT xxx FROM xxx LEFT JOIN xxx but this is not understood by the ZODBCDA driver. -- Christophe DELARUE E-Generis Tel.: (+33) 299 842052 Fax.: (+33) 299 639331 13, sq. du Chene Germain / 35510 Cesson-Sevigne / France mailto:cdelarue@e-generis.com
I know this will sound dumb to you but when dealing with ZSqlMethod in loops use <dtml-var "correction"> not <dtml-var correction> -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org] On Behalf Of Delarue Christophe Sent: Friday, April 12, 2002 9:17 AM To: zope@zope.org Subject: [Zope] ZSqlMethod and Brain Class This is my first Zope usage ... I've an ODBC Connection for two tables : FA -- ref name Done --- ref correction This Done table may not have a ref entry event if FA has. To edit the FA, I've got a ZSqlMethod SQLQuery which take a `ref' as arg. I edit this by http://host/SQLQuery/Ref/3414/EditRef the EditRef is a DtmlMethod which want to display something if there is data in the Done table. 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 I suppose I've got a namespace problem. I do not understand. thank's for any help. NOTE : I've tried a SELECT xxx FROM xxx LEFT JOIN xxx but this is not understood by the ZODBCDA driver. -- Christophe DELARUE E-Generis Tel.: (+33) 299 842052 Fax.: (+33) 299 639331 13, sq. du Chene Germain / 35510 Cesson-Sevigne / France mailto:cdelarue@e-generis.com _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
zopedan writes:
I know this will sound dumb to you but when dealing with ZSqlMethod in loops use <dtml-var "correction"> not <dtml-var correction>
If I put <dtml-var "correction">, I've got : Error Value: global name 'Correction' is not defined with <dtml-var correction >, I've got : Error Value: Correction The problem is the dtml-with as Dieter Maurer suggest :
"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]">' ....
This works fine. -- Christophe DELARUE E-Generis Tel.: (+33) 299 842052 Fax.: (+33) 299 639331 13, sq. du Chene Germain / 35510 Cesson-Sevigne / France mailto:cdelarue@e-generis.com
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
participants (3)
-
Delarue Christophe -
Dieter Maurer -
zopedan