Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/chat
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2006-05-05 18:17:57 (GMT)
committer Dan Williams <dcbw@redhat.com>2006-05-05 18:17:57 (GMT)
commitca378af28663e304bfa969bdeb43b08ce138a950 (patch)
tree4ab93d6bd79cb3e0fa1f314cc1c95408005b6026 /chat
parent06fb5b3e8a44a26383df863b09bfd7022580349c (diff)
Print local traceback on XMLRPC server exceptions
Diffstat (limited to 'chat')
-rwxr-xr-xchat/chat.py2
-rw-r--r--chat/network.py34
-rw-r--r--chat/p2p.py2
3 files changed, 36 insertions, 2 deletions
diff --git a/chat/chat.py b/chat/chat.py
index a5f3fc8..2948c26 100755
--- a/chat/chat.py
+++ b/chat/chat.py
@@ -341,7 +341,7 @@ class GroupChat(Chat):
def _buddy_recv_message(self, sender, msg):
chat = sender.chat()
if not chat:
- chat = BuddyChat(self, sender)
+ chat = BuddyChat(self._parent, sender)
sender.set_chat(chat)
chat.activity_connect_to_shell()
chat.recv_message(message)
diff --git a/chat/network.py b/chat/network.py
index dc80a94..fa35548 100644
--- a/chat/network.py
+++ b/chat/network.py
@@ -75,6 +75,40 @@ class GlibXMLRPCServer(GlibTCPServer, SimpleXMLRPCServer.SimpleXMLRPCDispatcher)
SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self)
GlibTCPServer.__init__(self, addr, requestHandler)
+ def _marshaled_dispatch(self, data, dispatch_method = None):
+ """Dispatches an XML-RPC method from marshalled (XML) data.
+
+ XML-RPC methods are dispatched from the marshalled (XML) data
+ using the _dispatch method and the result is returned as
+ marshalled data. For backwards compatibility, a dispatch
+ function can be provided as an argument (see comment in
+ SimpleXMLRPCRequestHandler.do_POST) but overriding the
+ existing method through subclassing is the prefered means
+ of changing method dispatch behavior.
+ """
+
+ params, method = xmlrpclib.loads(data)
+
+ # generate response
+ try:
+ if dispatch_method is not None:
+ response = dispatch_method(method, params)
+ else:
+ response = self._dispatch(method, params)
+ # wrap response in a singleton tuple
+ response = (response,)
+ response = xmlrpclib.dumps(response, methodresponse=1)
+ except Fault, fault:
+ response = xmlrpclib.dumps(fault)
+ except:
+ traceback.print_exc()
+ # report exception back to server
+ response = xmlrpclib.dumps(
+ xmlrpclib.Fault(1, "%s:%s" % (sys.exc_type, sys.exc_value))
+ )
+
+ return response
+
class GroupChatController(object):
diff --git a/chat/p2p.py b/chat/p2p.py
index df223d1..fb21eb9 100644
--- a/chat/p2p.py
+++ b/chat/p2p.py
@@ -13,7 +13,7 @@ class GroupRequestHandler(object):
def message(self, message):
address = network.get_authinfo()
- self._group.recv(address[0], message)
+ self._group.recv(address, message)
class Owner:
instance = None