RE: [Zope] XMLRPC accessing Zope DTML/SQL methods
Mayers, Philip J writes:
def extmethod(self, REQUEST): return str(REQUEST)
From the web that prints the string Representation of REQUEST. But, over XMLRPC, this:
s=xmlrpblib.Server("http://server.name/Zope/path/") s.path.extmethod()
Returns the string representation of REQUEST, but *this*
s.path.extmethod('rrr')
return 'rrr'. What's happening? That's the ZPublisher magic:
it tries to match the requirements of the called object with what is provided by the request. In your first example, you did not provide a parameter, but your function requires one. ZPublisher determined the "REQUEST" object as candidate based on the parameters name. In your second example, you did provide a parameter. ZPublisher used this positional parameter to satisfy the first positional parameter of your function. Thus, if your function requires two parameters: say 'text' and 'REQUEST', your second example would behave as your first now does. There is a document on zope.org that describes this ZPublisher magic in more detail. But maybe, you already know enough to fulfill your requirements. Dieter
participants (1)
-
Dieter Maurer