-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On call issue 239 fix #245
On call issue 239 fix #245
Conversation
I'm open for a similar patch, with few changes: Rename Resolve to |
I'm fine with renaming the call to service to ._dispatch_call. Renaming any function "_dispatch*" in protocol.py however will break it, because it scans for functions named that at the end of it and matches them with protocol DISPATCH constants. |
Oops, sorry, confused _handle with _dispatch. Working on patch. |
Okay, changes made. Check to see that you are happy with how the dict() call on kwargs ended up getting moved. I'd prefer not to have the keyword arguments passed to me in the tuple format. There is no preserving ordering for them anyways, as they come from kwargs stored in a dictionary. Also, how would you like this documented? I think we should get this documented in Sphinx before this pull request is merged in finally. |
You don't seem to have pushed your changes. |
Hmm, guess I committed and didn't push. That means I had to redo the changes since I won't have access to the machine I did that on for almost a month (away on vacation). I have redone the changes/tested them/and pushed them. |
Thanks |
Hi, I have changed my mind about this and reverted these changes. But fear not: you will now have an alternative solution that is even more powerful and generic (all the while requiring less code and keeping it simpler): The service object now controls which protocol to use. All you need to do is set the Alternatively, the request handlers can individually be overriden by installing a custom handler into class Service(rpyc.Service):
def on_connect(self, conn):
conn._HANDLERS.update({
HANDLE_CALL: self._handle_call,
})
def _handle_call(self, conn, obj, args, kwargs):
print("dispatching call:", obj, args, kwargs)
return conn._handle_call(obj, args, kwargs) Note that the request handlers now feel much more high-level because they receive the object itself rather than the object ID. This makes them a lot more convenient to override. |
Issue #239 fix here. It could use some documentation being added, but thought I'd put it for debate first. This basically fixes it by checking the root service for an option "on_call" method, and if available, that method is used to dispatch the calls instead.
This is also one of 3 pull requests (PR #245, PR #246, PR #247) I am submitting that I need acceptance on to go forward with a large optional 3rd party support library for RPyC that adds allows for an enhanced security model.