OCA / server-env

Tools to manage environment-dependent configuration
GNU Affero General Public License v3.0
57 stars 157 forks source link

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

Closed sbidoul closed 1 year ago

sbidoul commented 1 year ago

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

sbidoul commented 1 year ago

@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.

legalsylvain commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

/ocabot merge patch

OCA-git-bot commented 1 year ago

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 commented 1 year ago

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