-
Notifications
You must be signed in to change notification settings - Fork 77
fix: Failing invenio-admin due to lazy string #531
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mesemus
wants to merge
1
commit into
inveniosoftware:master
Choose a base branch
from
oarepo:contribution-bugfix-529
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
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.
this change does only affects the
adminpage or?this would mean that
InvenioRDMis not affected by this change?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.
Yes, this is the old flask-admin implementation which is not used in InvenioRDM anymore, so RDM is not affected.
The RDM implementation of user administration is directly in invenio_app_rdm and does not use this code.
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.
Given that context (and since these views are more or less deprecated), maybe the simplest/least risky fix is just to drop the translations here instead of adding the property override logic?
That way we avoid breaking overrides and keep the code minimal. What do you think @mesemus @utnapischtim ?
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.
We still use this module in some services at CERN e.g. https://github.com/CERNDocumentServer/cds-videos . Checking quickly our code we do override the column labels dict but not for the
SessionActivityVieworUserIdentityViewso it is fine from our side... Can we make the change backwards compatible e.g. implement a dict like class?Uh oh!
There was an error while loading. Please reload this page.
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.
"LazyTranslationDict" would not raise Exception in the Child class, but would not provide working translation as well. Let's have:
The common way of extending is with
**:If we do this, the values would get converted to plain string at the time of initialization, not at the time of request. That means that the UI would get the translation for the locale of the server, not the locale of the actual request.
With property, the same child code will fail at the time of initialization:
and would force fixing the "Child" class. The fix would be to convert it to property as well, and then the translation for "mykey" would start to work.
@jma @zzacharo do you plan to have translations in your own admin classes? If you plan to migrate to RDM & new administration and do not need to have functioning translation of /admin, then I would say let's just remove the lazy_gettext from here and keep it untranslated.
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.
In our case, we have only english translation so it is not a problem... That said, we are also installing
invenio-accounts==5.1.7so maybe it is also ok the "breaking change" as part of thev6.0.0major release.... given the fact that invenio-admin is somewhat deprecated for most of the instances... But indeed @jma how it is impacting you?