python 3 fixes

Added django's inbuilt support for object's string representation
This commit is contained in:
aarif
2019-08-29 20:17:12 +05:00
parent 36066458a4
commit 38543006a3

View File

@@ -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: