mirror of
https://github.com/searxng/searxng.git
synced 2024-12-23 09:46:31 +00: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:
parent
c225db45c8
commit
bdac99d4f0
1 changed files with 3 additions and 1 deletions
|
@ -284,8 +284,10 @@ def int_or_zero(num):
|
||||||
|
|
||||||
|
|
||||||
def is_valid_lang(lang):
|
def is_valid_lang(lang):
|
||||||
|
if isinstance(lang, bytes):
|
||||||
|
lang = lang.decode()
|
||||||
is_abbr = (len(lang) == 2)
|
is_abbr = (len(lang) == 2)
|
||||||
lang = lang.lower().decode()
|
lang = lang.lower()
|
||||||
if is_abbr:
|
if is_abbr:
|
||||||
for l in language_codes:
|
for l in language_codes:
|
||||||
if l[0][:2] == lang:
|
if l[0][:2] == lang:
|
||||||
|
|
Loading…
Reference in a new issue