Making the request/client information available in the method context #140
tom-cook-veea
started this conversation in
Ideas
Replies: 1 comment
-
Having had no response on this, we've gone ahead and implemented what we're proposing as #144. Feedback welcome. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We are in the process of converting our code to using bus-next from pydbus. But there are a couple of changes that we'd like to see that would make the transition much easier.
Firstly, it would be really useful if methods wrapped with the
dbus.method()
decorator still returned their return value when they are called from a non-dbus context. There is a pull request open at #119 to resolve this but there has been no response after five months.Secondly, it would be really useful to be able to get some information about the client in the dbus call contexts. We've seen #132 which sort of addressed this but personally I agree that what was proposed is not the best way of doing this. I'd propose adding a context-local pseudo-global variable that contains some client and message information. This could be done using
contextvars
, with usage looking something like this:The exact content of the
current_client
andcurrent_message
objects remains TBD and could of course be iterated.We're willing to do the work implementing this but wanted to discuss whether the approach is in line with your thinking before we invest the time to do it and just lob a PR over the fence.
Could you please comment on whether this is the sort of approach you'd like to see, or if there's another approach you'd rather see? Feedback on what should go in the
current_client
andcurrent_message
objects would also be useful (and I expect others from my organisation might well turn up to comment on this aspect).Beta Was this translation helpful? Give feedback.
All reactions