(self, seq, request)
| 168 | pass |
| 169 | |
| 170 | def localcall(self, seq, request): |
| 171 | self.debug("localcall:", request) |
| 172 | try: |
| 173 | how, (oid, methodname, args, kwargs) = request |
| 174 | except TypeError: |
| 175 | return ("ERROR", "Bad request format") |
| 176 | if oid not in self.objtable: |
| 177 | return ("ERROR", f"Unknown object id: {oid!r}") |
| 178 | obj = self.objtable[oid] |
| 179 | if methodname == "__methods__": |
| 180 | methods = {} |
| 181 | _getmethods(obj, methods) |
| 182 | return ("OK", methods) |
| 183 | if methodname == "__attributes__": |
| 184 | attributes = {} |
| 185 | _getattributes(obj, attributes) |
| 186 | return ("OK", attributes) |
| 187 | if not hasattr(obj, methodname): |
| 188 | return ("ERROR", f"Unsupported method name: {methodname!r}") |
| 189 | method = getattr(obj, methodname) |
| 190 | try: |
| 191 | if how == 'CALL': |
| 192 | ret = method(*args, **kwargs) |
| 193 | if isinstance(ret, RemoteObject): |
| 194 | ret = remoteref(ret) |
| 195 | return ("OK", ret) |
| 196 | elif how == 'QUEUE': |
| 197 | request_queue.put((seq, (method, args, kwargs))) |
| 198 | return("QUEUED", None) |
| 199 | else: |
| 200 | return ("ERROR", "Unsupported message type: %s" % how) |
| 201 | except SystemExit: |
| 202 | raise |
| 203 | except KeyboardInterrupt: |
| 204 | raise |
| 205 | except OSError: |
| 206 | raise |
| 207 | except Exception as ex: |
| 208 | return ("CALLEXC", ex) |
| 209 | except: |
| 210 | msg = "*** Internal Error: rpc.py:SocketIO.localcall()\n\n"\ |
| 211 | " Object: %s \n Method: %s \n Args: %s\n" |
| 212 | print(msg % (oid, method, args), file=sys.__stderr__) |
| 213 | traceback.print_exc(file=sys.__stderr__) |
| 214 | return ("EXCEPTION", None) |
| 215 | |
| 216 | def remotecall(self, oid, methodname, args, kwargs): |
| 217 | self.debug("remotecall:asynccall: ", oid, methodname) |
no test coverage detected