[Twisted-Python] RE: waiting on transport return

Jean-Paul Calderone exarkun at divmod.com
Fri Dec 9 12:01:14 EST 2005


On Fri, 9 Dec 2005 09:03:52 -0700, jmbenski at micron.com wrote:
>I'm not trying to bump my question, but if someone could tell me if I'm just being stupid and missing something with this code or that it isn't possible to do what I need with a spawned process?  If I know it isn't possible, I can just continue down the path I am.  It's not too much of a pain, but it just feels...wrong.
>

The code mostly seems good to me.  The only thing I might change is 
completely trivial: instead of passing a Deferred in to sendCommand, 
I'd have sendCommand be responsible for creating the Deferred and 
then return it, so your application code would look like this - 

  d = self.processprotocol.sendCommand("syncCmd", cmd)
  d.addCallback(self.handleTheCommand)
  d.addCallback(Self.theRestOfTheCommands)

I'm not sure from where your unhappyness with the version you posted 
stems, so I'm not sure what other comments to make.

Jean-Paul




More information about the Twisted-Python mailing list