Skip to content
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

[16.0][FIX] don't use deprecated locale.getdefaultlocale() #163

Merged
merged 2 commits into from
Sep 6, 2023

Conversation

sbidoul
Copy link
Member

@sbidoul sbidoul commented Aug 28, 2023

locale.getdefaultlocale() is deprecated in python 3.11. Use getlocale() instead.

@sbidoul sbidoul added this to the 16.0 milestone Aug 28, 2023
@sbidoul
Copy link
Member Author

sbidoul commented Aug 28, 2023

@simahawk @gurneyalex would you like to have a look at this little one?

While looking at this I noticed this get_environment() function is called repeatedly (notably each time the registry is built), and it does potentially costly subprocess calls (git, bzr, lsb_release). So I took the opportunity to cache it.

@sbidoul sbidoul changed the title [16.0][FIX] don't use deprecated get_default_locale [16.0][FIX] don't use deprecated locale.getdefaultlocale() Aug 28, 2023
@legalsylvain
Copy link
Contributor

legalsylvain commented Aug 28, 2023

While looking at this I noticed this get_environment() function is called repeatedly (notably each time the registry is built), and it does potentially costly subprocess calls (git, bzr, lsb_release). So I took the opportunity to cache it.

AFAIK, get_server_environment is called only by the model server.config that has, In my opinion nothing to do in this module. It allows to see configuration parameter in a view of a transient model.

image

  1. this feature can be usefull without the module server_environment installed.
  2. something may be wrong in this part of the code, if you notice that calls are made regularly. (this should not be the case).
  3. this feature can provide security issues.

So I'm in favor to move all that part (server.config + system_info.py) in a dedicated module named server_configuration_visualisation (or something like this).

What do you think ?

Note : this code didn't changed since the creation (version 6.1 : https://github.com/OCA/server-tools/blob/6.1/server_environment/system_info.py)

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@sbidoul
Copy link
Member Author

sbidoul commented Sep 6, 2023

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 16.0-ocabot-merge-pr-163-by-sbidoul-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit cfe7469 into OCA:16.0 Sep 6, 2023
6 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at e2f48c0. Thanks a lot for contributing to OCA. ❤️

@sbidoul sbidoul deleted the 16.0-fix-getdefaultlocale-sbi branch September 6, 2023 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants