From 07263f3a0e84ac876dd39496ef8c3017b7ee5981 Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Wed, 24 Oct 2012 14:42:53 -0400 Subject: [PATCH] Rearrange functions (imported from commit 814f2acbf574bf1eeb32e23ab28e76fc94f877ce) --- zephyr/views.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/zephyr/views.py b/zephyr/views.py index 8b07350a54..b21ccb4289 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -236,6 +236,22 @@ def update_pointer_backend(request, user_profile): return json_success() +@asynchronous +@login_required_json_view +def json_get_updates(request, handler): + if not ('last' in request.POST and 'first' in request.POST): + return json_error("Missing message range") + user_profile = UserProfile.objects.get(user=request.user) + + return get_updates_backend(request, user_profile, handler, apply_markdown=True) + +@asynchronous +@login_required_api_view +def api_get_messages(request, user_profile, handler): + return get_updates_backend(request, user_profile, handler, + apply_markdown=(request.POST.get("apply_markdown") is not None), + mirror=request.POST.get("mirror")) + def format_updates_response(messages=[], apply_markdown=True, reason_empty=None, user_profile=None, new_pointer=None, where='bottom', mirror=None): @@ -403,26 +419,10 @@ def get_updates_backend(request, user_profile, handler, **kwargs): user_profile.add_receive_callback(handler.async_callback(cb)) user_profile.add_pointer_update_callback(handler.async_callback(cb)) -@asynchronous -@login_required_json_view -def json_get_updates(request, handler): - if not ('last' in request.POST and 'first' in request.POST): - return json_error("Missing message range") - user_profile = UserProfile.objects.get(user=request.user) - - return get_updates_backend(request, user_profile, handler, apply_markdown=True) - @login_required_api_view def api_get_profile(request, user_profile): return json_success({"pointer": user_profile.pointer}) -@asynchronous -@login_required_api_view -def api_get_messages(request, user_profile, handler): - return get_updates_backend(request, user_profile, handler, - apply_markdown=(request.POST.get("apply_markdown") is not None), - mirror=request.POST.get("mirror")) - @login_required_api_view def api_send_message(request, user_profile): return send_message_backend(request, user_profile, user_profile,