request: Rename validator parameter of REQ to json_validator.

This makes it much more clear that this feature does JSON encoding,
which previously was only indicated in the documentation.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2021-04-07 13:00:44 -07:00
committed by Tim Abbott
parent 93d2ae8092
commit f0e655f1d8
39 changed files with 291 additions and 259 deletions

View File

@@ -19,7 +19,7 @@ from zerver.models import UserProfile
def update_storage(
request: HttpRequest,
user_profile: UserProfile,
storage: Dict[str, str] = REQ(validator=check_dict([], value_validator=check_string)),
storage: Dict[str, str] = REQ(json_validator=check_dict([], value_validator=check_string)),
) -> HttpResponse:
try:
set_bot_storage(user_profile, list(storage.items()))
@@ -32,7 +32,7 @@ def update_storage(
def get_storage(
request: HttpRequest,
user_profile: UserProfile,
keys: Optional[List[str]] = REQ(validator=check_list(check_string), default=None),
keys: Optional[List[str]] = REQ(json_validator=check_list(check_string), default=None),
) -> HttpResponse:
keys = keys or get_keys_in_bot_storage(user_profile)
try:
@@ -46,7 +46,7 @@ def get_storage(
def remove_storage(
request: HttpRequest,
user_profile: UserProfile,
keys: Optional[List[str]] = REQ(validator=check_list(check_string), default=None),
keys: Optional[List[str]] = REQ(json_validator=check_list(check_string), default=None),
) -> HttpResponse:
keys = keys or get_keys_in_bot_storage(user_profile)
try: