Print more debug info

This commit is contained in:
Dan Williams 2006-05-05 14:27:46 -04:00
parent 3acdb18d26
commit 615eb60550
3 changed files with 41 additions and 4 deletions

View File

@ -344,7 +344,7 @@ class GroupChat(Chat):
chat = BuddyChat(self, sender) chat = BuddyChat(self, sender)
sender.set_chat(chat) sender.set_chat(chat)
chat.activity_connect_to_shell() chat.activity_connect_to_shell()
chat.recv_message(sender, msg) chat.recv_message(message)
def run(self): def run(self):
try: try:

View File

@ -75,6 +75,41 @@ class GlibXMLRPCServer(GlibTCPServer, SimpleXMLRPCServer.SimpleXMLRPCDispatcher)
SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self) SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self)
GlibTCPServer.__init__(self, addr, requestHandler) 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:
print "Exception while processing request:"
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): class GroupChatController(object):

View File

@ -2,6 +2,7 @@ import os
import pwd import pwd
import xmlrpclib import xmlrpclib
import socket import socket
import traceback
import presence import presence
import BuddyList import BuddyList
@ -14,7 +15,6 @@ class GroupRequestHandler(object):
def message(self, message): def message(self, message):
address = network.get_authinfo() address = network.get_authinfo()
self._group.recv(address[0], message) self._group.recv(address[0], message)
return True
class Owner: class Owner:
instance = None instance = None
@ -93,9 +93,11 @@ class Group:
peer = xmlrpclib.ServerProxy(addr) peer = xmlrpclib.ServerProxy(addr)
success = True success = True
try: try:
print self._serialize_msg(pipe_id, msg)
peer.message(self._serialize_msg(pipe_id, msg)) peer.message(self._serialize_msg(pipe_id, msg))
except (socket.error, xmlrpclib.Fault), e: except (socket.error, xmlrpclib.Fault, xmlrpclib.ProtocolError), e:
print str(e) print "Message Send Error:"
traceback.print_exc()
success = False success = False
return success return success