diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py index 69e4fea0ad..c2f8827928 100644 --- a/lms/djangoapps/instructor/views/api.py +++ b/lms/djangoapps/instructor/views/api.py @@ -520,7 +520,7 @@ def generate_random_string(length): if char not in 'aAeEiIoOuU1l' ] - return string.join((random.choice(chars) for __ in range(length)), '') + return ''.join((random.choice(chars) for i in range(length))) def generate_unique_password(generated_passwords, password_length=12): diff --git a/lms/djangoapps/instructor_task/models.py b/lms/djangoapps/instructor_task/models.py index 72daed9b4f..3c055cdc9d 100644 --- a/lms/djangoapps/instructor_task/models.py +++ b/lms/djangoapps/instructor_task/models.py @@ -321,5 +321,5 @@ class DjangoStorageReportStore(ReportStore): """ Return the full path to a given file for a given course. """ - hashed_course_id = hashlib.sha1(text_type(course_id)).hexdigest() + hashed_course_id = hashlib.sha1(text_type(course_id).encode('utf-8')).hexdigest() return os.path.join(hashed_course_id, filename) diff --git a/lms/djangoapps/instructor_task/tests/test_tasks_helper.py b/lms/djangoapps/instructor_task/tests/test_tasks_helper.py index 8a29c442d8..91fa03b734 100644 --- a/lms/djangoapps/instructor_task/tests/test_tasks_helper.py +++ b/lms/djangoapps/instructor_task/tests/test_tasks_helper.py @@ -1367,7 +1367,7 @@ class TestExecutiveSummaryReport(TestReportMixin, InstructorTaskCourseTestCase): report_html_filename = report_store.links_for(self.course.id)[0][0] report_path = report_store.path_to(self.course.id, report_html_filename) with report_store.storage.open(report_path) as html_file: - html_file_data = html_file.read() + html_file_data = html_file.read().decode('utf-8') for data in expected_data: self.assertIn(data, html_file_data)