[Twisted-Python] Dealing with an intermittent PB server
Dave Cook
daverz at gmail.com
Tue Feb 15 20:56:15 MST 2005
I'm rendering the results of a remote method call:
def data_tableList(self, ctx, data):
...
d = self.pbClientFactory.login(creds)
d.addCallback(lambda object: object.callRemote("foo"))
return d
Works, great if the PB server is up, but if it's down the browser
just hangs. Is there a correct way to check that the connection is up
at this point? This works:
if self.pbClientFactory._broker:
d = self.pbClientFactory.login(creds)
d.addCallback(lambda object: object.callRemote("getAlertReports"))
else:
d = []
return d
but seems like a hack. Also, ideally, I'd like to attempt a
reconnection to the PB server at this point if it's not running.
What's the best way to do that?
Thanks,
Dave Cook
More information about the Twisted-Python
mailing list