Here are the examples of the python api twisted.spread.pb.ProtocolError taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
3
Example 1
Project: mythbox Source File: service.py
def receiveExplorer(self, objectLink):
"""Pass an Explorer on to my clients.
"""
clients = self.clients.keys()
for client in clients:
try:
client.callRemote('receiveExplorer', objectLink)
except pb.ProtocolError:
# Stale broker.
self.detached(client, None)
0
Example 2
def console(self, message):
"""Pass a message to my clients' console.
"""
clients = self.clients.keys()
origMessage = message
compatMessage = None
for client in clients:
try:
if not client.capabilities.has_key("Failure"):
if compatMessage is None:
compatMessage = origMessage[:]
for i in xrange(len(message)):
if ((message[i][0] == "exception") and
isinstance(message[i][1], failure.Failure)):
compatMessage[i] = (
message[i][0],
_failureOldStyle(message[i][1]))
client.callRemote('console', compatMessage)
else:
client.callRemote('console', message)
except pb.ProtocolError:
# Stale broker.
self.detached(client, None)
0
Example 3
def console(self, message):
"""Pass a message to my clients' console.
"""
clients = self.clients.keys()
origMessage = message
compatMessage = None
for client in clients:
try:
if "Failure" not in client.capabilities:
if compatMessage is None:
compatMessage = origMessage[:]
for i in xrange(len(message)):
if ((message[i][0] == "exception") and
isinstance(message[i][1], failure.Failure)):
compatMessage[i] = (
message[i][0],
_failureOldStyle(message[i][1]))
client.callRemote('console', compatMessage)
else:
client.callRemote('console', message)
except pb.ProtocolError:
# Stale broker.
self.detached(client, None)