Thursday, June 03, 2010

Here are my changes in netsvc

class GenericXMLRPCRequestHandler(OpenERPDispatcher):
    def _dispatch(self, method, params):
        try:
            service_name = self.path.split("/")[-1]
            return self.dispatch(service_name, method, params)
        except OpenERPDispatcherException, e:
#            raise xmlrpclib.Fault(tools.exception_to_unicode(e.exception), e.traceback)
            if 'xmlrpclib' in self.headers.getheader('User-Agent'):
                raise xmlrpclib.Fault(tools.exception_to_unicode(e.exception), e.traceback)
            else:
                raise xmlrpclib.Fault(1,tools.exception_to_unicode(e.exception))

The result is that instead of getting a casting error, you get the correct exception like in : org.apache.xmlrpc.XmlRpcException: 'super' object has no attribute '__getattr__'

Which is what you see on the console... Well Open ERP messages are sometimes a bit cryptic in fact in this case the called method does not exist on the object...

No comments: