[Zope] ZSqlMethod and Brain Class

zopedan zopedan@hotmail.com
Thu, 11 Apr 2002 12:49:27 -0700


I know this will sound dumb to you but when dealing with ZSqlMethod in
loops use <dtml-var "correction"> not <dtml-var correction>

=20



-----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=20

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=3Dself.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.

--=20
Christophe DELARUE        E-Generis
Tel.: (+33) 299 842052 =A0=A0 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 )