mirror of
https://github.com/zulip/zulip.git
synced 2025-10-29 19:13:53 +00:00
Revert "validator: Add generic check_or."
This reverts commit cd93d0967f.
This check_or is redundant with check_union; it gives a misleading
error message for the non-matching case; and it has no type safety.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
cd93d0967f
commit
0f7d0a23c9
@@ -582,15 +582,3 @@ def check_string_or_int(var_name: str, val: object) -> Union[str, int]:
|
||||
return val
|
||||
|
||||
raise ValidationError(_("{var_name} is not a string or integer").format(var_name=var_name))
|
||||
|
||||
|
||||
def check_or(sub_validator1: Validator[Any], sub_validator2: Validator[Any]) -> Validator[Any]:
|
||||
def f(var_name: str, val: object) -> Validator[Any]:
|
||||
try:
|
||||
return sub_validator1(var_name, val)
|
||||
except ValidationError:
|
||||
pass
|
||||
|
||||
return sub_validator2(var_name, val)
|
||||
|
||||
return f
|
||||
|
||||
Reference in New Issue
Block a user