[Zope] Calling ZSQL from PythonMethods (was RE: [Zope] ZSQL, Python meth ods and XMLRPC) ods and XMLRPC)

Mayers, Philip J p.mayers@ic.ac.uk
Fri, 19 Jan 2001 13:47:51 -0000


Hmm - with regard calling ZSQL method from PythonMethod, this works:

def pythonmethod(self):
    a = []
    for v in self.SQL_list_something():
        a.append(v.field)
    return a

<dtml-var pythonmethod>

*But* of course I can't pass "self" over XMLRPC. Why does self.ZSQL_method()
work, but:

def pythonmethod(meth):
    a = []
    for v in meth():
        a.append(v.field)
    return a

<dtml-var "pythonmethod(ZSQL_method)">

Give "__call__ not defined"?

Regards,
Phil

+----------------------------------+
| Phil Mayers, Network Support     |
| Centre for Computing Services    |
| Imperial College                 |
+----------------------------------+  

-----Original Message-----
From: Mayers, Philip J [mailto:p.mayers@ic.ac.uk]
Sent: 18 January 2001 22:37
To: 'zope@zope.org'
Subject: [Zope] ZSQL, Python methods and XMLRPC


I've three questions (but I'm making progress!):

1) In 2.2.5, how can I call a ZSQL method from a Python Method - I'm passing
the method in as a parameter, and the furthest I get says "__call__ not
defined".

Do PythonScripts obivate the need for this? I assume I can just do this:

for record in context.folder.subfolder.SQL_method(val1='a',val2='b'):
    # do stuff

Does that work?

2) When calling a DTML method over XMLRPC, <dtml-in
"SQL_method(username=AUTHENTICATED_USER)"> doesn't work, but <dtml-in
"SQL_method(username=REQUEST.AUTHENTICATED_USER)"> does. Why?

3) Why aren't record values (the return of an SQL method) marshallable over
XMLRPC. I get this:

cannot marshal <extension class ExtensionClass at 70356ff4> objects


Regards,
Phil

_______________________________________________
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 )