From aa0801907d018c8d7a35938b3173ce520d2b7a72 Mon Sep 17 00:00:00 2001 From: Jason Bau Date: Wed, 18 Sep 2013 23:47:31 -0700 Subject: [PATCH] use .get when checking combined notifications to handle missing keys --- .../open_ended_grading/open_ended_notifications.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/open_ended_grading/open_ended_notifications.py b/lms/djangoapps/open_ended_grading/open_ended_notifications.py index 34b8e7036b..6e915b9372 100644 --- a/lms/djangoapps/open_ended_grading/open_ended_notifications.py +++ b/lms/djangoapps/open_ended_grading/open_ended_notifications.py @@ -152,8 +152,9 @@ def combined_notifications(course, user): controller_response = controller_qs.check_combined_notifications(course.id, student_id, user_is_staff, last_time_viewed) notifications = json.loads(controller_response) - if notifications['success']: - if notifications['staff_needs_to_grade'] or notifications['student_needs_to_peer_grade']: + if notifications.get('success'): + if (notifications.get('staff_needs_to_grade') or + notifications.get('student_needs_to_peer_grade')): pending_grading = True except: #Non catastrophic error, so no real action