Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Support flask-babel 3.0 #3501

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

eryg-kai
Copy link

What does this PR do?

Allows searx to run with flask-babel 3.0. The driving motivation was to fix the package on NixOS which is not honoring dependency versions (NixOS/nixpkgs#216695).

The error:

AttributeError: 'Babel' object has no attribute 'localeselector'

The fix:

The way the locale selector is added has changed somewhat, and I needed to move get_locale up to make use of it.

Why is this change important?

I just want it to work with NixOS but keeping dependencies up to date is good in general.

How to test this PR locally?

I just ran make test with and without the updated requirements to make sure searx runs with both 2.0 and 3.0 without any errors.

Related issues

Obviates #3497

babel.init_app(app)
babel.localeselector(get_locale)
else:
babel.init_app(app, locale_selector=get_locale)
Copy link
Contributor

@jecarr jecarr Sep 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*Only commenting as I came across this recently too

If you're changing the versions in requirements.txt to be fixed (i.e. 3.1.0 which throws the AttributeError), is it worth having this if-else?

I'd think you either keep this approach but cater for (include) a lower version in the requirements file or have a cleaner diff (mine was this).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants