From e48f8bdafde2071a0ff3fb84df5a5b64ddfe0e23 Mon Sep 17 00:00:00 2001 From: Umair Khan Date: Mon, 2 Apr 2018 18:19:25 +0500 Subject: [PATCH] check_short_string: Use check_capped_string for impl. --- zerver/lib/validator.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/zerver/lib/validator.py b/zerver/lib/validator.py index 94ed6f6396..c5a75978b6 100644 --- a/zerver/lib/validator.py +++ b/zerver/lib/validator.py @@ -39,13 +39,7 @@ def check_string(var_name: str, val: object) -> Optional[str]: return None def check_short_string(var_name: str, val: object) -> Optional[str]: - if not isinstance(val, str): - return _('%s is not a string') % (var_name,) - max_length = 50 - if len(val) >= max_length: - return _("{var_name} is longer than {max_length}.".format( - var_name=var_name, max_length=max_length)) - return None + return check_capped_string(var_name, val, 50) def check_capped_string(var_name: str, val: object, max_length: int) -> Optional[str]: if not isinstance(val, str):