Re: How to Catch Errors in SimpleXMLRPCServer

2007-09-27 Thread Jeff McNeil
Cool.. glad it works. Just be careful not to expose methods you may not want to; use decorators, attributes, or perhaps a custom method naming scheme to flag methods as exposed if you do it this way. On 9/27/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > On Sep 27, 5:08 pm, "Jeff McNeil" <[

Re: How to Catch Errors in SimpleXMLRPCServer

2007-09-27 Thread [EMAIL PROTECTED]
On Sep 27, 5:08 pm, "Jeff McNeil" <[EMAIL PROTECTED]> wrote: > Yeah, that code was out of memory and I didn't test it, my apologies. > Need to actually return a value from _dispatch. > > class MyCalls(object): >def _dispatch(self, method, args): >try: >return getattr(self, m

Re: How to Catch Errors in SimpleXMLRPCServer

2007-09-27 Thread Jeff McNeil
Yeah, that code was out of memory and I didn't test it, my apologies. Need to actually return a value from _dispatch. class MyCalls(object): def _dispatch(self, method, args): try: return getattr(self, method)(*args) except: handle_logging() server = SimpleX

Re: How to Catch Errors in SimpleXMLRPCServer

2007-09-27 Thread [EMAIL PROTECTED]
On Sep 27, 3:55 pm, "Jeff McNeil" <[EMAIL PROTECTED]> wrote: > Instead of register_function, use register_instance and provide a > _dispatch method in that instance that handles your exception logging. > > Pseudo: > > class MyCalls(object): > def _dispatch(self, method, args): > try: >

Re: How to Catch Errors in SimpleXMLRPCServer

2007-09-27 Thread Jeff McNeil
getattr, not self.getattr. On 9/27/07, Jeff McNeil <[EMAIL PROTECTED]> wrote: > Instead of register_function, use register_instance and provide a > _dispatch method in that instance that handles your exception logging. > > Pseudo: > > class MyCalls(object): > def _dispatch(self, method, args):

Re: How to Catch Errors in SimpleXMLRPCServer

2007-09-27 Thread Jeff McNeil
Instead of register_function, use register_instance and provide a _dispatch method in that instance that handles your exception logging. Pseudo: class MyCalls(object): def _dispatch(self, method, args): try: self.getattr(self, method)(*args) except: han

Re: How to Catch Errors in SimpleXMLRPCServer

2007-09-27 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I have a pretty simple XMLRPCServer, something along the lines of the > example: > > server = SimpleXMLRPCServer(("localhost", 8000)) > server.register_function(pow) > server.register_function(lambda x,y: x+y, 'add') > server.serve_forever() > > Now what I want to do

How to Catch Errors in SimpleXMLRPCServer

2007-09-27 Thread [EMAIL PROTECTED]
I have a pretty simple XMLRPCServer, something along the lines of the example: server = SimpleXMLRPCServer(("localhost", 8000)) server.register_function(pow) server.register_function(lambda x,y: x+y, 'add') server.serve_forever() Now what I want to do is catch any errors that happen on requests,