fix(shared): validator value type can be wrong

This commit is contained in:
jo 2022-07-30 21:11:45 +02:00 committed by Kyle Robbertze
parent dec51eacee
commit 6c449e3019
1 changed files with 4 additions and 2 deletions

View File

@ -9,8 +9,10 @@ if TYPE_CHECKING:
def no_trailing_slash_validator(key: str) -> "AnyClassMethod":
# pylint: disable=unused-argument
def strip_trailing_slash(cls: Any, value: str) -> str:
return value.rstrip("/")
def strip_trailing_slash(cls: Any, value: Any) -> Any:
if isinstance(value, str):
return value.rstrip("/")
return value
return validator(key, pre=True, allow_reuse=True)(strip_trailing_slash)