From d1de513cdfe2d7b6f88725a0d3a7c3c71cbffa3a Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Wed, 11 Sep 2019 15:18:30 +0500 Subject: [PATCH 1/2] BOM-410 Fixing python3 --- lms/djangoapps/instructor_task/api_helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/djangoapps/instructor_task/api_helper.py b/lms/djangoapps/instructor_task/api_helper.py index 01e9400775..349ec1e6b1 100644 --- a/lms/djangoapps/instructor_task/api_helper.py +++ b/lms/djangoapps/instructor_task/api_helper.py @@ -413,7 +413,7 @@ def encode_entrance_exam_and_student_input(usage_key, student=None): task_key_stub = "_{entranceexam}".format(entranceexam=text_type(usage_key)) # create the key value by using MD5 hash: - task_key = hashlib.md5(task_key_stub).hexdigest() + task_key = hashlib.md5(task_key_stub.encode('utf-8')).hexdigest() return task_input, task_key From ff98318aa4b66a70396c45107d76c0ab5c292e00 Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Wed, 11 Sep 2019 16:04:06 +0500 Subject: [PATCH 2/2] BOM-416 Fixing python3 --- lms/djangoapps/discussion/notification_prefs/tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/discussion/notification_prefs/tests.py b/lms/djangoapps/discussion/notification_prefs/tests.py index f56df81963..b959884056 100644 --- a/lms/djangoapps/discussion/notification_prefs/tests.py +++ b/lms/djangoapps/discussion/notification_prefs/tests.py @@ -3,6 +3,7 @@ from __future__ import absolute_import import json +import six from django.contrib.auth.models import AnonymousUser from django.core.exceptions import PermissionDenied from django.http import Http404 @@ -61,7 +62,7 @@ class NotificationPrefViewTest(UrlResetMixin, TestCase): # now coerce username to utf-8 encoded str, since we test with non-ascii unicdoe above and # the unittest framework has hard time coercing to unicode. # decrypt also can't take a unicode input, so coerce its input to str - self.assertEqual(str(user.username.encode('utf-8')), UsernameCipher().decrypt(str(pref.value))) + self.assertEqual(six.binary_type(user.username.encode('utf-8')), UsernameCipher().decrypt(str(pref.value))) def assertNotPrefExists(self, user): """Ensure that the user does not have a persisted preference"""