mirror of
https://github.com/searxng/searxng.git
synced 2025-07-12 07:49:22 +02:00
[mod] int_or_zero refactored to searx_utils
This commit is contained in:
parent
c3232b0e1a
commit
33fd938016
3 changed files with 23 additions and 29 deletions
|
@ -290,6 +290,15 @@ def convert_str_to_int(number_str):
|
|||
return 0
|
||||
|
||||
|
||||
# convert a variable to integer or return 0 if it's not a number
|
||||
def int_or_zero(num):
|
||||
if isinstance(num, list):
|
||||
if len(num) < 1:
|
||||
return 0
|
||||
num = num[0]
|
||||
return convert_str_to_int(num)
|
||||
|
||||
|
||||
def is_valid_lang(lang):
|
||||
is_abbr = (len(lang) == 2)
|
||||
if is_abbr:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue