예제 #1
0
파일: pyrpc.py 프로젝트: eclipse/triquetrum
    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
예제 #2
0
    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
예제 #3
0
 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)
예제 #4
0
파일: pyrpc.py 프로젝트: eclipse/triquetrum
 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
예제 #5
0
 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
예제 #6
0
 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