Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
searx-engine
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
searx-engine
Commits
ba7c8d7b
Commit
ba7c8d7b
authored
Apr 15, 2020
by
Noémi Ványi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[fix] remove usage of request context where not available
parent
826ef3d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
webapp.py
searx/webapp.py
+5
-6
No files found.
searx/webapp.py
View file @
ba7c8d7b
...
...
@@ -56,6 +56,7 @@ from flask import (
from
babel.support
import
Translations
import
flask_babel
from
flask_babel
import
Babel
,
gettext
,
format_date
,
format_decimal
from
flask.ctx
import
has_request_context
from
flask.json
import
jsonify
from
searx
import
brand
from
searx
import
settings
,
searx_dir
,
searx_debug
...
...
@@ -165,13 +166,11 @@ _flask_babel_get_translations = flask_babel.get_translations
# monkey patch for flask_babel.get_translations
def
_get_translations
():
translation_locale
=
request
.
form
.
get
(
'use-translation'
)
if
translation_locale
:
if
has_request_context
()
and
request
.
form
.
get
(
'use-translation'
)
==
'oc'
:
babel_ext
=
flask_babel
.
current_app
.
extensions
[
'babel'
]
translation
=
Translations
.
load
(
next
(
babel_ext
.
translation_directories
),
'oc'
)
else
:
translation
=
_flask_babel_get_translations
()
return
translation
return
Translations
.
load
(
next
(
babel_ext
.
translation_directories
),
'oc'
)
return
_flask_babel_get_translations
()
flask_babel
.
get_translations
=
_get_translations
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment