[Twisted-web] Deferred inside XMLRPC method
karnaugh at karnaugh.za.net
Thu Aug 30 07:09:58 EDT 2007
On 30/08/2007 12:55 Daniel de la Cuesta wrote:
> I am developing an middleware XMLRPC Server. It connects with a mail
> server and provides and XMLRPC interface to read and send mail.
> Is there any way to return the result of the xmlrpc method in deferred's
> Is there any way to return a deferred object inside the xmlrpc method?
> Is it a good solution using asynchronous chunks (deferreds) inside a
> synchronous protocol as it is XML-RPC (HTTP)?
I use this pattern on the server side
def xmlrpc_getStuff(self, stuff):
print "Oh dear!"
otherstuff = doStuffWith(dbResult)
return self.db.getStuff(stuff).addCallbacks(returnStuff, fail)
And this one on the client side
return Proxy(xmlServer, allowNone=True).callRemote('getStuff',
There are better ways depending on what you're really doing..
Colin Alston ~ http://www.karnaugh.za.net/
"To the world you may be one person, to one person you may be the
world" ~ Rachel Ann Nunes.
Terms and conditions: http://www.karnaugh.za.net/email.rpy
More information about the Twisted-web