diff options
author | Alexandre Flament <alex@al-f.net> | 2020-09-08 16:08:37 +0200 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2020-09-10 10:49:42 +0200 |
commit | bdac99d4f0349a71d7ecb9a4c61687356afedd6b (patch) | |
tree | d3863e22b3d34092484146ce0bdc6e0ca8d36216 /searx/utils.py | |
parent | c225db45c8a4ab466bff049216f7e0189dc1b067 (diff) | |
download | searxng-bdac99d4f0349a71d7ecb9a4c61687356afedd6b.tar.gz searxng-bdac99d4f0349a71d7ecb9a4c61687356afedd6b.zip |
Drop Python 2 (5/n): searx.utils.is_valid_lang, input parameter is a str instead of bytes
Fix bug in translated.py and dictzone.py
Diffstat (limited to 'searx/utils.py')
-rw-r--r-- | searx/utils.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/searx/utils.py b/searx/utils.py index de5b68ca3..d8842c65f 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -284,8 +284,10 @@ def int_or_zero(num): def is_valid_lang(lang): + if isinstance(lang, bytes): + lang = lang.decode() is_abbr = (len(lang) == 2) - lang = lang.lower().decode() + lang = lang.lower() if is_abbr: for l in language_codes: if l[0][:2] == lang: |