Merge remote-tracking branch 'edx/master' into opaque-keys-merge-master

Conflicts:
	cms/djangoapps/contentstore/views/item.py
	cms/djangoapps/contentstore/views/tests/test_container.py
	cms/djangoapps/contentstore/views/tests/test_tabs.py
	common/lib/xmodule/xmodule/modulestore/mongo/draft.py
	lms/djangoapps/certificates/management/commands/gen_cert_report.py
	lms/djangoapps/certificates/queue.py
	lms/djangoapps/certificates/views.py
	lms/djangoapps/courseware/module_render.py
	lms/djangoapps/courseware/tests/test_module_render.py
	lms/djangoapps/instructor/views/api.py
	lms/djangoapps/instructor/views/instructor_dashboard.py
	lms/djangoapps/instructor/views/legacy.py
	lms/djangoapps/shoppingcart/tests/test_models.py
	lms/djangoapps/verify_student/views.py
This commit is contained in:
Calen Pennington
2014-05-09 15:29:32 -04:00
577 changed files with 153911 additions and 12180 deletions

View File

@@ -15,6 +15,8 @@ from verify_student.models import SoftwareSecurePhotoVerification
import json
import random
import logging
import lxml
from lxml.etree import XMLSyntaxError, ParserError
from xmodule.modulestore import Location
@@ -170,11 +172,13 @@ class XQueueCertInterface(object):
if course is None:
course = courses.get_course_by_id(course_id)
profile = UserProfile.objects.get(user=student)
profile_name = profile.name
# Needed
self.request.user = student
self.request.session = {}
course_name = course.display_name or course_id
is_whitelisted = self.whitelist.filter(user=student, course_id=course_id, whitelist=True).exists()
grade = grades.grade(student, self.request, course)
enrollment_mode = CourseEnrollment.enrollment_mode_for_user(student, course_id)
@@ -199,9 +203,16 @@ class XQueueCertInterface(object):
cert.user = student
cert.grade = grade['percent']
cert.course_id = course_id
cert.name = profile.name
cert.name = profile_name
# Strip HTML from grade range label
grade_contents = grade.get('grade', None)
try:
grade_contents = lxml.html.fromstring(grade_contents).text_content()
except (TypeError, XMLSyntaxError, ParserError) as e:
# Despite blowing up the xml parser, bad values here are fine
grade_contents = None
if is_whitelisted or grade['grade'] is not None:
if is_whitelisted or grade_contents is not None:
# check to see whether the student is on the
# the embargoed country restricted list
@@ -218,9 +229,16 @@ class XQueueCertInterface(object):
contents = {
'action': 'create',
'username': student.username,
<<<<<<< HEAD
'course_id': course_id.to_deprecated_string(),
'name': profile.name,
'grade': grade['grade'],
=======
'course_id': course_id,
'course_name': course_name,
'name': profile_name,
'grade': grade_contents,
>>>>>>> edx/master
'template_pdf': template_pdf,
}
if template_file:
@@ -230,8 +248,8 @@ class XQueueCertInterface(object):
cert.save()
self._send_to_xqueue(contents, key)
else:
new_status = status.notpassing
cert.status = new_status
cert_status = status.notpassing
cert.status = cert_status
cert.save()
return new_status