correcting a validation issue for 'voyage'

This commit is contained in:
Max Metz 2024-08-01 18:34:56 +02:00
parent be6c898415
commit 3ce2fc829d

View File

@ -1,7 +1,8 @@
import typing
from string import ascii_letters, digits from string import ascii_letters, digits
def check_if_string_has_special_characters(text:str): def check_if_string_has_special_characters(text:typing.Optional[str]):
""" """
check, whether there are any characters within the provided string, which are not found in the ascii letters or digits check, whether there are any characters within the provided string, which are not found in the ascii letters or digits
ascii_letters: abcd (...) and ABCD (...) ascii_letters: abcd (...) and ABCD (...)
@ -11,6 +12,8 @@ def check_if_string_has_special_characters(text:str):
User: https://stackoverflow.com/users/10035985/andrej-kesely User: https://stackoverflow.com/users/10035985/andrej-kesely
returns bool returns bool
""" """
if text is None:
return False
return bool(set(text).difference(ascii_letters + digits + ' ')) return bool(set(text).difference(ascii_letters + digits + ' '))