Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
docs: Remove recommendations of json_validator with check_string.
Tim Abbott0044c8f85fce
diff --git a/docs/tutorials/new-feature-tutorial.md b/docs/tutorials/new-feature-tutorial.mdindex ecc032fcbbf..07f234d8640 100644--- a/docs/tutorials/new-feature-tutorial.md+++ b/docs/tutorials/new-feature-tutorial.md@@ -415,7 +415,7 @@ annotation).def update_realm(request: HttpRequest,user_profile: UserProfile,- name: Optional[str] = REQ(json_validator=check_string, default=None),+ name: Optional[str] = REQ(str_validator=check_string, default=None),# ...+ mandatory_topics: Optional[bool] = REQ(json_validator=check_bool, default=None),# ...diff --git a/docs/tutorials/writing-views.md b/docs/tutorials/writing-views.mdindex 604e7fd5413..d62e4e524d5 100644--- a/docs/tutorials/writing-views.md+++ b/docs/tutorials/writing-views.md@@ -194,6 +194,11 @@ REQ also helps us with request variable validation. For example:integer (`converter` differs from `json_validator` in that it doesnot automatically marshall the input from JSON).+* Since there is no need to JSON-encode strings, usually simply+ `my_string=REQ()` is correct. One can pass e.g.+ `str_validator=check_string_in(...)` where one wants to run a+ validator on the value of a string.+See[zerver/lib/validator.py](https://github.com/zulip/zulip/blob/master/zerver/lib/validator.py)for more validators and their documentation.@@ -261,7 +266,7 @@ For example, in [zerver/views/realm.py](https://github.com/zulip/zulip/blob/mast@has_request_variablesdef update_realm(request: HttpRequest, user_profile: UserProfile,- name: Optional[str]=REQ(json_validator=check_string, default=None),+ name: Optional[str]=REQ(str_validator=check_string, default=None),# ...):realm = user_profile.realm