From bbcab7314a07ec2d34347935a7808e4e9f8a297f Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 22 Jan 2013 14:10:01 -0500 Subject: [PATCH] Anonymous users don't have an email attribute, and shouldn't be checked for CourseEnrollmentAllowed --- lms/djangoapps/courseware/access.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/djangoapps/courseware/access.py b/lms/djangoapps/courseware/access.py index a176d2a171..f58c53c0cc 100644 --- a/lms/djangoapps/courseware/access.py +++ b/lms/djangoapps/courseware/access.py @@ -127,7 +127,7 @@ def _has_access_course_desc(user, course, action): return True # if user is in CourseEnrollmentAllowed with right course_id then can also enroll - if user is not None and CourseEnrollmentAllowed: + if user is not None and user.is_authenticated() and CourseEnrollmentAllowed: if CourseEnrollmentAllowed.objects.filter(email=user.email, course_id=course.id): return True