From 328bcbe0479930452c0e65ba097129df5de9caf7 Mon Sep 17 00:00:00 2001 From: Amit <43564590+amitvadhel@users.noreply.github.com> Date: Thu, 9 May 2019 17:08:57 +0300 Subject: [PATCH] INCR-135: Run python-modernize on common/djangoapps/edxmako (#20483) --- common/djangoapps/edxmako/apps.py | 2 ++ common/djangoapps/edxmako/makoloader.py | 2 ++ common/djangoapps/edxmako/paths.py | 5 ++++- common/djangoapps/edxmako/request_context.py | 2 ++ common/djangoapps/edxmako/shortcuts.py | 9 ++++++--- common/djangoapps/edxmako/template.py | 2 ++ common/djangoapps/edxmako/tests.py | 2 ++ 7 files changed, 20 insertions(+), 4 deletions(-) diff --git a/common/djangoapps/edxmako/apps.py b/common/djangoapps/edxmako/apps.py index fa1aa515f8..c52ed044ef 100644 --- a/common/djangoapps/edxmako/apps.py +++ b/common/djangoapps/edxmako/apps.py @@ -1,6 +1,8 @@ """ Configuration for the edxmako Django application. """ +from __future__ import absolute_import + from django.apps import AppConfig from django.conf import settings from . import add_lookup, clear_lookups diff --git a/common/djangoapps/edxmako/makoloader.py b/common/djangoapps/edxmako/makoloader.py index 7980143e78..8a5833be24 100644 --- a/common/djangoapps/edxmako/makoloader.py +++ b/common/djangoapps/edxmako/makoloader.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import + import logging from django.conf import settings diff --git a/common/djangoapps/edxmako/paths.py b/common/djangoapps/edxmako/paths.py index 8e57f17c96..11217befd1 100644 --- a/common/djangoapps/edxmako/paths.py +++ b/common/djangoapps/edxmako/paths.py @@ -2,9 +2,12 @@ Set up lookup paths for mako templates. """ +from __future__ import absolute_import + import contextlib import hashlib import os +import six import pkg_resources from django.conf import settings @@ -18,7 +21,7 @@ from openedx.core.lib.cache_utils import request_cached from . import LOOKUP -class TopLevelTemplateURI(unicode): +class TopLevelTemplateURI(six.text_type): """ A marker class for template URIs used to signal the template lookup infrastructure that the template corresponding to the URI should be looked up straight in the standard edx-platform location instead of trying to locate an diff --git a/common/djangoapps/edxmako/request_context.py b/common/djangoapps/edxmako/request_context.py index 5be4c1fd47..081fd5f7f2 100644 --- a/common/djangoapps/edxmako/request_context.py +++ b/common/djangoapps/edxmako/request_context.py @@ -19,6 +19,8 @@ Methods for creating RequestContext for using with Mako templates. """ +from __future__ import absolute_import + from crum import get_current_request from django.template import RequestContext diff --git a/common/djangoapps/edxmako/shortcuts.py b/common/djangoapps/edxmako/shortcuts.py index d187cd3540..e43478070f 100644 --- a/common/djangoapps/edxmako/shortcuts.py +++ b/common/djangoapps/edxmako/shortcuts.py @@ -12,8 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import absolute_import + import logging -from urlparse import urljoin +import six +from six.moves.urllib.parse import urljoin from django.conf import settings from django.urls import reverse @@ -113,8 +116,8 @@ def marketing_link_context_processor(request): [ ("MKTG_URL_" + k, marketing_link(k)) for k in ( - settings.MKTG_URL_LINK_MAP.viewkeys() | - marketing_urls.viewkeys() + six.viewkeys(settings.MKTG_URL_LINK_MAP) | + six.viewkeys(marketing_urls) ) ] ) diff --git a/common/djangoapps/edxmako/template.py b/common/djangoapps/edxmako/template.py index 3a4f8cb9dd..a8ade8f09e 100644 --- a/common/djangoapps/edxmako/template.py +++ b/common/djangoapps/edxmako/template.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import absolute_import + from django.conf import settings from django.template import Context, engines from mako.template import Template as MakoTemplate diff --git a/common/djangoapps/edxmako/tests.py b/common/djangoapps/edxmako/tests.py index 4f96e680e2..29af0070d6 100644 --- a/common/djangoapps/edxmako/tests.py +++ b/common/djangoapps/edxmako/tests.py @@ -1,3 +1,5 @@ +from __future__ import absolute_import + import unittest import ddt