1
0
mirror of https://github.com/searx/searx synced 2024-12-11 19:49:33 +01:00

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
This commit is contained in:
Alexandre Flament 2020-09-08 16:08:37 +02:00
parent c225db45c8
commit bdac99d4f0

View File

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