From 3a1c68fb305ebcfc7b331fc1009330605c0d6956 Mon Sep 17 00:00:00 2001 From: Amit <43564590+amitvadhel@users.noreply.github.com> Date: Mon, 13 May 2019 16:29:07 +0300 Subject: [PATCH] INCR-243: Make compatible with Python 3.x without breaking Python 2.7 support for openedx/core/djangoapps/models openedx/core/djangoapps/debug (#20532) --- openedx/core/djangoapps/debug/views.py | 3 +++ openedx/core/djangoapps/models/course_details.py | 9 +++++---- .../core/djangoapps/models/tests/test_course_details.py | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/openedx/core/djangoapps/debug/views.py b/openedx/core/djangoapps/debug/views.py index d0a4da96ed..2f7e0ddfd0 100644 --- a/openedx/core/djangoapps/debug/views.py +++ b/openedx/core/djangoapps/debug/views.py @@ -3,10 +3,13 @@ Views that are only activated when the project is running in development mode. These views will NOT be shown on production: trying to access them will result in a 404 error. """ +from __future__ import absolute_import + import bleach from django.http import HttpResponseNotFound from django.template import TemplateDoesNotExist from django.utils.translation import ugettext as _ + from edxmako.shortcuts import render_to_response from openedx.core.djangoapps.util.user_messages import PageLevelMessages diff --git a/openedx/core/djangoapps/models/course_details.py b/openedx/core/djangoapps/models/course_details.py index 3d3dae7d16..c00a1319e1 100644 --- a/openedx/core/djangoapps/models/course_details.py +++ b/openedx/core/djangoapps/models/course_details.py @@ -1,17 +1,18 @@ """ CourseDetails """ -import re +from __future__ import absolute_import + import logging +import re from django.conf import settings -from xmodule.fields import Date -from xmodule.modulestore.exceptions import ItemNotFoundError from openedx.core.djangolib.markup import HTML from openedx.core.lib.courses import course_image_url +from xmodule.fields import Date from xmodule.modulestore.django import modulestore - +from xmodule.modulestore.exceptions import ItemNotFoundError # This list represents the attribute keys for a course's 'about' info. # Note: The 'video' attribute is intentionally excluded as it must be diff --git a/openedx/core/djangoapps/models/tests/test_course_details.py b/openedx/core/djangoapps/models/tests/test_course_details.py index 703758704d..b089a99ca0 100644 --- a/openedx/core/djangoapps/models/tests/test_course_details.py +++ b/openedx/core/djangoapps/models/tests/test_course_details.py @@ -2,16 +2,18 @@ Tests for CourseDetails """ +from __future__ import absolute_import + import datetime + import ddt from pytz import UTC +from openedx.core.djangoapps.models.course_details import ABOUT_ATTRIBUTES, CourseDetails from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -from openedx.core.djangoapps.models.course_details import CourseDetails, ABOUT_ATTRIBUTES - @ddt.ddt class CourseDetailsTestCase(ModuleStoreTestCase):