summaryrefslogtreecommitdiff
path: root/searx/webapp.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2019-12-02 13:39:58 +0000
committerGitHub <noreply@github.com>2019-12-02 13:39:58 +0000
commit731e34299d128f9352fd76e603c960c1f0628ed9 (patch)
treef591dc036131f2c3a045fbc557f66afc905646cb /searx/webapp.py
parent574cb25a16c3011f1797115cb6c90117e9bd1e8e (diff)
parent85b37233458c21b775bf98568c0a5c9260aa14fe (diff)
downloadsearxng-731e34299d128f9352fd76e603c960c1f0628ed9.tar.gz
searxng-731e34299d128f9352fd76e603c960c1f0628ed9.zip
Merge pull request #1744 from dalf/optimizations
[mod] speed optimization
Diffstat (limited to 'searx/webapp.py')
-rw-r--r--searx/webapp.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/searx/webapp.py b/searx/webapp.py
index 183bf1975..7cf4106d3 100644
--- a/searx/webapp.py
+++ b/searx/webapp.py
@@ -157,20 +157,18 @@ outgoing_proxies = settings['outgoing'].get('proxies') or None
@babel.localeselector
def get_locale():
- locale = request.accept_languages.best_match(settings['locales'].keys())
-
- if request.preferences.get_value('locale') != '':
- locale = request.preferences.get_value('locale')
+ if 'locale' in request.form\
+ and request.form['locale'] in settings['locales']:
+ return request.form['locale']
if 'locale' in request.args\
and request.args['locale'] in settings['locales']:
- locale = request.args['locale']
+ return request.args['locale']
- if 'locale' in request.form\
- and request.form['locale'] in settings['locales']:
- locale = request.form['locale']
+ if request.preferences.get_value('locale') != '':
+ return request.preferences.get_value('locale')
- return locale
+ return request.accept_languages.best_match(settings['locales'].keys())
# code-highlighter