def _xmlrpchandler_common(self, destination, args, debug=False, suspend=False): try: handler = self._handlers.get(destination) if handler is None: ret = Exception("No handler registered for " + destination) else: unflattened = map(_flatten.unflatten, args) if debug: # do the import here, pydevd must already be in the sys. # it is important that the import is within the outer try/except # so that import error gets propagated back up as # an AnalysisRpcException import pydevd # @UnresolvedImport # Initialise debug, without the suspend, next settrace sets the # suspend if needed. This split makes it easier to detect cause # of failure if an exception is thrown. This line covers the # connection to the debug server, the next settrace then only # does the suspend. pydevd.settrace(suspend=False, **self.pydev_settrace_params) # Needs PyDev Debug Server Running # These two statements must be on same line so that suspend happens # on next executable line, being the first line of the handler # Run the registered Analysis RPC Handler. (If you are browsing # a stack trace, this is probably as high up the stack as you # want to go). pydevd.settrace(suspend=suspend); ret = handler(*unflattened) else: ret = handler(*unflattened) flatret = _flatten.flatten(ret) except Exception as e: flatret = _flatten.flatten(e) return flatret
def _xmlrpchandler_common(self, destination, args, debug=False, suspend=False): try: handler = self._handlers.get(destination) if handler is None: ret = Exception("No handler registered for " + destination) else: unflattened = list(map(_flatten.unflatten, args)) if debug: # do the import here, pydevd must already be in the sys. # it is important that the import is within the outer try/except # so that import error gets propagated back up as # an AnalysisRpcException import pydevd # @UnresolvedImport # Initialise debug, without the suspend, next settrace sets the # suspend if needed. This split makes it easier to detect cause # of failure if an exception is thrown. This line covers the # connection to the debug server, the next settrace then only # does the suspend. pydevd.settrace(suspend=False, **self.pydev_settrace_params) # Needs PyDev Debug Server Running # These two statements must be on same line so that suspend happens # on next executable line, being the first line of the handler # Run the registered Analysis RPC Handler. (If you are browsing # a stack trace, this is probably as high up the stack as you # want to go). pydevd.settrace(suspend=suspend); ret = handler(*unflattened) else: ret = handler(*unflattened) flatret = _flatten.flatten(ret) except Exception as e: flatret = _flatten.flatten(e) return flatret
def _xmlrpchandler(self, destination, args): try: handler = self._handlers.get(destination) if handler is None: ret = Exception("No handler registered for " + destination) else: unflattened = map(_flatten.unflatten, args) ret = handler(*unflattened) flatret = _flatten.flatten(ret) except Exception, e: flatret = _flatten.flatten(e)
def _request_common(self, destination, params, debug=False, suspend=False): flatargs = _flatten.flatten(params) if debug: flatret = self._serverProxy.Analysis.handler_debug(destination, flatargs, suspend) else: flatret = self._serverProxy.Analysis.handler(destination, flatargs) unflatret = _flatten.unflatten(flatret) if (isinstance(unflatret, Exception)): raise unflatret return unflatret
def request(self, destination, params): ''' Perform a request to the Server, directing it at the destination which was registered as the handler on the server, passing it the params specified. params must be a tuple or a list of the arguments ''' flatargs = _flatten.flatten(params) flatret = self._serverProxy.Analysis.handler(destination, flatargs) unflatret = _flatten.unflatten(flatret) if (isinstance(unflatret, Exception)): raise unflatret return unflatret