From 718fb0f5b83d870c7a8312435b1fa942c6848368 Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Fri, 20 Sep 2019 16:03:28 +0500 Subject: [PATCH 1/2] BOM-585 Fixing python3 --- openedx/core/djangoapps/embargo/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/embargo/models.py b/openedx/core/djangoapps/embargo/models.py index 0951ffd8aa..a920a1817a 100644 --- a/openedx/core/djangoapps/embargo/models.py +++ b/openedx/core/djangoapps/embargo/models.py @@ -39,6 +39,7 @@ from .messages import COURSEWARE_MESSAGES, ENROLL_MESSAGES log = logging.getLogger(__name__) +@python_2_unicode_compatible class EmbargoedCourse(models.Model): """ Enable course embargo on a course-by-course basis. @@ -68,7 +69,7 @@ class EmbargoedCourse(models.Model): except cls.DoesNotExist: return False - def __unicode__(self): + def __str__(self): not_em = "Not " if self.embargoed: not_em = "" From 75b5fffb87f4cbcd98a2ad915a432ecdef9bc468 Mon Sep 17 00:00:00 2001 From: Awais Qureshi Date: Fri, 20 Sep 2019 16:11:47 +0500 Subject: [PATCH 2/2] BOM-584 Fixing python3 --- openedx/core/djangoapps/embargo/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openedx/core/djangoapps/embargo/models.py b/openedx/core/djangoapps/embargo/models.py index a920a1817a..3cbd93b255 100644 --- a/openedx/core/djangoapps/embargo/models.py +++ b/openedx/core/djangoapps/embargo/models.py @@ -375,6 +375,7 @@ class RestrictedCourse(models.Model): log.info("Invalidated cached messaging URLs ") +@python_2_unicode_compatible class Country(models.Model): """Representation of a country. @@ -389,7 +390,7 @@ class Country(models.Model): help_text=ugettext_lazy(u"Two character ISO country code.") ) - def __unicode__(self): + def __str__(self): return u"{name} ({code})".format( name=six.text_type(self.country.name), code=six.text_type(self.country) @@ -400,6 +401,7 @@ class Country(models.Model): ordering = ['country'] +@python_2_unicode_compatible class CountryAccessRule(models.Model): """Course access rule based on the user's country. @@ -522,7 +524,7 @@ class CountryAccessRule(models.Model): # that have access to the course. return list(whitelist_countries - blacklist_countries) - def __unicode__(self): + def __str__(self): if self.rule_type == self.WHITELIST_RULE: return _(u"Whitelist {country} for {course}").format( course=six.text_type(self.restricted_course.course_key),