[Zope] XML-RPC woes

Tony McDonald tony.mcdonald@ncl.ac.uk
Fri, 11 Feb 2000 13:39:50 +0000


Hi all,
I'm trying to get this to work **from a XXX PythonMethod** (ie the 
ones that allow you to import things and are coloured red and orange!)

PythonMethod do_par

import xmlrpclib

server_url="http://xmlrpc.server:9999"
server=xmlrpclib.Server(server_url)
server.getTranscript(number)

I call it with a dtml doc

<form action="do_par" method=post>
<input type=text name="number:int">
</form>

The PythonMethod returns a blank page (whether from the form or the 'try' tab)

If I make the PythonMethod be;
import xmlrpclib

def doit(number):
     server_url="http://xmlrpc.server:9999"
     server=xmlrpclib.Server(server_url)
     return server.getTranscript(number)

doit(number)

Then I get this error, when called from either the form or the 'try' tab.
<!--
  Error type:  NameError
  Error value: xmlrpclib
  -->
<!--
Traceback (innermost last):
   File /home/nnle/MEDFAC_SERVER/lib/python/ZPublisher/Publish.py, 
line 214, in publish_module
   File /home/nnle/MEDFAC_SERVER/lib/python/ZPublisher/Publish.py, 
line 179, in publish
   File /home/nnle/MEDFAC_SERVER/lib/python/Zope/__init__.py, line 
202, in zpublisher_exception_hook
     (Object: ElementWithAttributes)
   File /home/nnle/MEDFAC_SERVER/lib/python/ZPublisher/Publish.py, 
line 165, in publish
   File /home/nnle/MEDFAC_SERVER/lib/python/ZPublisher/mapply.py, line 
160, in mapply
     (Object: do_par)
   File /home/nnle/MEDFAC_SERVER/lib/python/ZPublisher/Publish.py, 
line 102, in call_object
     (Object: do_par)
   File 
/home/nnle/MEDFAC_SERVER/lib/python/Products/PythonMethod/PythonMethod 
.py, line 168, in __call__
     (Object: do_par)
     (Info: (('961160610',), {}, None))
   File &lt;string&gt;, line 9, in do_par
   File &lt;string&gt;, line 6, in doit
NameError: (see above)

-->

I'd like to work from PythonMethods as they offer the promise of 
speedy editing, so what am I doing wrong this time? :(

getTranscript does work, because all this code works from the Python 
interpreter.

ta
tone.
------
Dr Tony McDonald,  FMCC, Networked Learning Environments Project 
http://nle.ncl.ac.uk/
The Medical School, Newcastle University Tel: +44 191 222 5888
Fingerprint: 3450 876D FA41 B926 D3DD  F8C3 F2D0 C3B9 8B38 18A2