[Twisted-Python] inlineCallbacks

Pet petshmidt at googlemail.com
Thu Oct 8 10:08:23 EDT 2009

On Thu, Oct 8, 2009 at 2:15 PM,  <exarkun at twistedmatrix.com> wrote:
> On 6 Oct, 02:47 pm, petshmidt at googlemail.com wrote:
>>calling in client code self.cred.login() I can't print login result.
>>What I'm doing wrong? login method returns deffered, but should yield
>>result from callRemote method.
>>Thanks for any help!
>>class Cred:
>>    @inlineCallbacks
>>    def login(self):
>>        proxy = Proxy(LOGIN_PROXY)
>>        l = {"user":LOGIN_USERNAME, "pass":LOGIN_PASSWD}
>>        loginResult = yield proxy.callRemote('login', l)
>>        print "RESULT", loginResult.result
>>        returnValue(loginResult)
> It's hard to tell what's going wrong since this example isn't complete.
> If I assume I know what Proxy does, then the code basically looks right
> - although I suspect you only want to print "loginResult", not
> "loginResult.result".  If you can post an sscce - http://sscce.org/ -
> someone might be able to be of more help.


I've misunderstood the concept of inlinecallbacks. I've thought they
makes deferred blocking "again" so execution of code stops until
result is available and didn't catch any errors of Proxy. Because
connection failed, there was no error and no result. I've finally
realized that inlinecallbacks do not change behavior of deferred and
now I simply use my login function as deferred with callbacks and


> Jean-Paul
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

More information about the Twisted-Python mailing list