From 720d04a98b102019c0e1b440ef265b03f33b3dd3 Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Wed, 14 Nov 2012 13:45:13 -0500 Subject: [PATCH] Use request variable decorator in @authenticated_api_view (imported from commit ec46ec307cfb34275ebc33e429663172d3f2d169) --- zephyr/decorator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zephyr/decorator.py b/zephyr/decorator.py index b829468962..541ae1c516 100644 --- a/zephyr/decorator.py +++ b/zephyr/decorator.py @@ -61,14 +61,14 @@ def update_user_activity(request, user_profile, client): def authenticated_api_view(view_func): @csrf_exempt @require_post + @has_request_variables @wraps(view_func) - def _wrapped_view_func(request, *args, **kwargs): - email = request.POST.get("email") + def _wrapped_view_func(request, email=POST, api_key=POST('api-key'), + *args, **kwargs): try: user_profile = UserProfile.objects.get(user__email=email) except UserProfile.DoesNotExist: return json_error("Invalid user: %s" % (email,)) - api_key = request.POST.get("api-key") if api_key != user_profile.api_key: return json_error("Invalid API key for user '%s'" % (email,)) update_user_activity(request, user_profile,