Use json_to_bool instead of simplejson.loads

(imported from commit 0d045c606925379450215349a17d6fe04d3f1be9)
This commit is contained in:
Zev Benjamin 2013-03-08 16:22:21 -05:00
parent 2da4c0a4bf
commit 203b0fcc25
1 changed files with 4 additions and 3 deletions

View File

@ -3,7 +3,7 @@ from zephyr.models import UserActivity
from zephyr.decorator import asynchronous, authenticated_api_view, \
authenticated_json_post_view, internal_notify_view, RespondAsynchronously, \
has_request_variables, POST, to_non_negative_int
has_request_variables, POST, to_non_negative_int, json_to_bool
from zephyr.lib.response import json_success
@ -39,7 +39,7 @@ def json_get_updates(request, user_profile, handler):
@authenticated_api_view
@has_request_variables
def api_get_messages(request, user_profile, handler, client_id=POST(default=None),
apply_markdown=POST(default=False, converter=simplejson.loads)):
apply_markdown=POST(default=False, converter=json_to_bool)):
return get_updates_backend(request, user_profile, handler, client_id,
apply_markdown=apply_markdown,
client=request._client)
@ -121,7 +121,8 @@ def get_updates_backend(request, user_profile, handler, client_id,
client_server_generation = POST(whence='server_generation', default=None,
converter=int),
client_pointer = POST(whence='pointer', converter=int, default=None),
dont_block = POST(converter=simplejson.loads, default=False),
dont_block = POST(converter=json_to_bool, default=False),
stream_name = POST(default=None), apply_markdown=True,
**kwargs):
resp = return_messages_immediately(user_profile, client_id, last,