tornado: Remove database queries from notify_pointer_update.

(imported from commit 218d5b804a4b4d9f7a1e9305165fd21820c26240)
This commit is contained in:
Tim Abbott 2013-01-09 10:36:29 -05:00
parent c3c59e938c
commit 8fe1edb6b0
1 changed files with 5 additions and 6 deletions

View File

@ -64,9 +64,9 @@ def get_user_pointer(user_profile_id):
def set_user_pointer(user_profile_id, pointer): def set_user_pointer(user_profile_id, pointer):
user_pointers[user_profile_id] = pointer user_pointers[user_profile_id] = pointer
def update_pointer(user_profile, new_pointer, pointer_updater): def update_pointer(user_profile_id, new_pointer, pointer_updater):
set_user_pointer(user_profile.id, new_pointer) set_user_pointer(user_profile_id, new_pointer)
callbacks_table.call(user_profile.id, Callbacks.TYPE_POINTER_UPDATE, callbacks_table.call(user_profile_id, Callbacks.TYPE_POINTER_UPDATE,
new_pointer=new_pointer, new_pointer=new_pointer,
update_types=["pointer_update"]) update_types=["pointer_update"])
@ -97,12 +97,11 @@ def notify_new_message(request):
@internal_notify_view @internal_notify_view
def notify_pointer_update(request): def notify_pointer_update(request):
# FIXME: better query user_profile_id = int(request.POST['user'])
user_profile = UserProfile.objects.get(id=request.POST['user'])
new_pointer = int(request.POST['new_pointer']) new_pointer = int(request.POST['new_pointer'])
pointer_updater = request.POST['pointer_updater'] pointer_updater = request.POST['pointer_updater']
update_pointer(user_profile, new_pointer, pointer_updater) update_pointer(user_profile_id, new_pointer, pointer_updater)
return json_success() return json_success()