check_short_string: Use check_capped_string for impl.

This commit is contained in:
Umair Khan 2018-04-02 18:19:25 +05:00 committed by Tim Abbott
parent 7fdf043564
commit e48f8bdafd
1 changed files with 1 additions and 7 deletions

View File

@ -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):