From 0b268e6a96e1886a1dd446b2f7fe483bdcc3adda Mon Sep 17 00:00:00 2001 From: Joaco Campero Date: Mon, 13 Nov 2023 23:56:01 +0100 Subject: [PATCH] fix(i18n): validate existing paths --- hexagon/support/input/types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hexagon/support/input/types.py b/hexagon/support/input/types.py index 0ddad05..b4b4b7f 100644 --- a/hexagon/support/input/types.py +++ b/hexagon/support/input/types.py @@ -30,7 +30,7 @@ def __get_validators__(cls, *args, **kwargs): def validate(cls, value: Path, field) -> Path: declaration_extras = copy(field.field_info.extra) - if declaration_extras.get("allow_nonexistent", True): + if not declaration_extras.get("allow_nonexistent", False): if not value.exists(): raise FileNotExistsError(path=value) @@ -50,7 +50,7 @@ def __get_validators__(cls): def validate(cls, value: Path, field) -> Path: declaration_extras = copy(field.field_info.extra) - if declaration_extras.get("allow_nonexistent", True): + if not declaration_extras.get("allow_nonexistent", False): if not value.exists(): raise DirectoryNotExistsError(path=value)