From 85b5190c29bc365739b1d5a500a7496ae0e97877 Mon Sep 17 00:00:00 2001 From: Victor Shnayder Date: Mon, 10 Dec 2012 10:41:40 -0500 Subject: [PATCH] fix login hack. Uses new return-error-msg-if-not-logged-in behavior --- lms/djangoapps/instructor/staff_grading_service.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/instructor/staff_grading_service.py b/lms/djangoapps/instructor/staff_grading_service.py index 8c9e02bdae..33c1d875af 100644 --- a/lms/djangoapps/instructor/staff_grading_service.py +++ b/lms/djangoapps/instructor/staff_grading_service.py @@ -89,7 +89,9 @@ class StaffGradingService(object): Returns the result of operation(). Does not catch exceptions. """ response = operation() - if (response.status_code == 302): + if (response.json + and response.json.get('success') == False + and response.json.get('error') == 'login_required'): # apparrently we aren't logged in. Try to fix that. r = self._login() if r and not r.get('success'): @@ -116,7 +118,7 @@ class StaffGradingService(object): Raises: GradingServiceError: something went wrong with the connection. """ - op = lambda: self.session.get(self.get_problem_list_url, + op = lambda: self.session.get(self.get_problem_list_url, allow_redirects = False, params={'course_id': course_id, 'grader_id': grader_id})