How to Catch Errors in SimpleXMLRPCServer

Jeff McNeil jeff at jmcneil.net
Fri Sep 28 02:37:22 CEST 2007


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, gregpinero at gmail.com <gregpinero at gmail.com> wrote:
>
> On Sep 27, 5:08 pm, "Jeff McNeil" <j... at jmcneil.net> 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, method)(*args)
> >        except:
> >            handle_logging()
> >
> > server = SimpleXMLRPCServer(("localhost", 8000))
> > server.register_instance(MyCalls())
> > server.serve_forever()
> >
>
> Thanks, that works.  I'm not sure why I didn't notice it wasn't
> returning anything.
>
> -Greg
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070927/632e98e7/attachment.html>


More information about the Python-list mailing list