-
-
Notifications
You must be signed in to change notification settings - Fork 216
Property Pages can now wire up services #3357
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Initialization has to happen somwhere else, so we can inject services.
So we can inject services in property pages.
The partial method can be used to inject services on arbitrary objects.
`@transactional` was a workaround for places where we had no access to services, mainly property pages. Now that property pages are resolved with dependency injection, there's no need to keep this workaround in place. Instead just pass the event_manager to the place where transactions need to be started.
88e1871
to
6d0f002
Compare
danyeaw
approved these changes
Jun 23, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @amolenaar, these changes look great, nice improvement!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Type
What kind of change does this PR introduce?
What is the current behavior?
We have a global
@transactional
decorator. This decorator works as long as the system is fully aware of the active session. This of course causes trouble if a non-active session starts to do something in the background.Issue Number: Fixes #3351.
What is the new behavior?
Instead, all places where transactions are started should have access to the services, mainly
event_manager
. This ensures that the transaction is run in the right context.Does this PR introduce a breaking change?
The
@transactional
decorator has been removed.Other information
I wanted to fix this for a long time. #3348 was the trigger to rethink the problem again. In the end it seemed pretty simple: the
component_registry
should have a method to (partially) apply services to any function or class.