From 38543006a387666c02935578c269aa2c651bd4e6 Mon Sep 17 00:00:00 2001 From: aarif Date: Thu, 29 Aug 2019 20:17:12 +0500 Subject: [PATCH] python 3 fixes Added django's inbuilt support for object's string representation --- lms/djangoapps/grades/course_data.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/grades/course_data.py b/lms/djangoapps/grades/course_data.py index bbf0a58d50..56e462c247 100644 --- a/lms/djangoapps/grades/course_data.py +++ b/lms/djangoapps/grades/course_data.py @@ -4,6 +4,8 @@ Code used to get and cache the requested course-data from __future__ import absolute_import +from django.utils.encoding import python_2_unicode_compatible + from lms.djangoapps.course_blocks.api import get_course_blocks from openedx.core.djangoapps.content.block_structure.api import get_block_structure_manager from xmodule.modulestore.django import modulestore @@ -11,6 +13,7 @@ from xmodule.modulestore.django import modulestore from .transformer import GradesTransformer +@python_2_unicode_compatible class CourseData(object): """ Utility access layer to intelligently get and cache the @@ -102,8 +105,8 @@ class CourseData(object): course_block = structure[self.location] return getattr(course_block, 'subtree_edited_on', None) - def __unicode__(self): - return u'Course: course_key: {}'.format(self.course_key) + def __str__(self): + return 'Course: course_key: {}'.format(self.course_key) def full_string(self): if self.effective_structure: