python 3 fixes
This commit is contained in:
@@ -92,7 +92,7 @@ def hash_resource(resource):
|
||||
Hash a :class:`web_fragments.fragment.FragmentResource`.
|
||||
"""
|
||||
md5 = hashlib.md5()
|
||||
md5.update(repr(resource))
|
||||
md5.update(repr(resource).encode('utf-8'))
|
||||
return md5.hexdigest()
|
||||
|
||||
|
||||
|
||||
@@ -2597,7 +2597,7 @@ class SplitMongoModuleStore(SplitBulkWriteMixin, ModuleStoreWriteBase):
|
||||
block_key.id,
|
||||
new_parent_block_key.id,
|
||||
)
|
||||
new_block_id = hashlib.sha1(unique_data).hexdigest()[:20]
|
||||
new_block_id = hashlib.sha1(unique_data.encode('utf-8')).hexdigest()[:20]
|
||||
new_block_key = BlockKey(block_key.type, new_block_id)
|
||||
|
||||
# Now clone block_key to new_block_key:
|
||||
|
||||
@@ -67,7 +67,7 @@ class BadgrBackend(BadgeBackend):
|
||||
if badge_class.issuing_component and badge_class.course_id:
|
||||
# Make this unique to the course, and down to 64 characters.
|
||||
# We don't do this to badges without issuing_component set for backwards compatibility.
|
||||
slug = hashlib.sha256(slug + six.text_type(badge_class.course_id)).hexdigest()
|
||||
slug = hashlib.sha256((slug + six.text_type(badge_class.course_id)).encode('utf-8')).hexdigest()
|
||||
if len(slug) > MAX_SLUG_LENGTH:
|
||||
# Will be 64 characters.
|
||||
slug = hashlib.sha256(slug).hexdigest()
|
||||
|
||||
@@ -176,7 +176,7 @@ class TestGetCourseListMultipleCourses(CourseListTestMixin, ModuleStoreTestCase)
|
||||
"""Verify that courses are filtered by the provided org key."""
|
||||
# Create a second course to be filtered out of queries.
|
||||
alternate_course = self.create_course(
|
||||
org=md5(self.course.org).hexdigest()
|
||||
org=md5(self.course.org.encode('utf-8')).hexdigest()
|
||||
)
|
||||
|
||||
self.assertNotEqual(alternate_course.org, self.course.org)
|
||||
|
||||
@@ -1225,7 +1225,7 @@ def hash_resource(resource):
|
||||
"""
|
||||
md5 = hashlib.md5()
|
||||
for data in resource:
|
||||
md5.update(repr(data))
|
||||
md5.update(repr(data).encode('utf-8'))
|
||||
return md5.hexdigest()
|
||||
|
||||
|
||||
|
||||
@@ -1402,7 +1402,7 @@ class TestProctoringRendering(SharedModuleStoreTestCase):
|
||||
)
|
||||
|
||||
if attempt_status:
|
||||
create_exam_attempt(exam_id, self.request.user.id, taking_as_proctored=True)
|
||||
create_exam_attempt(six.text_type(exam_id).encode('utf-8'), self.request.user.id, taking_as_proctored=True)
|
||||
update_attempt_status(exam_id, self.request.user.id, attempt_status)
|
||||
|
||||
return usage_key
|
||||
|
||||
Reference in New Issue
Block a user