diff --git a/openedx/core/djangoapps/theming/admin.py b/openedx/core/djangoapps/theming/admin.py index f8bce31414..5c465ad84f 100644 --- a/openedx/core/djangoapps/theming/admin.py +++ b/openedx/core/djangoapps/theming/admin.py @@ -1,6 +1,8 @@ """ Django admin page for theming models """ +from __future__ import absolute_import + from django.contrib import admin from .models import SiteTheme diff --git a/openedx/core/djangoapps/theming/apps.py b/openedx/core/djangoapps/theming/apps.py index e0da5456b8..2ff8a01b06 100644 --- a/openedx/core/djangoapps/theming/apps.py +++ b/openedx/core/djangoapps/theming/apps.py @@ -1,7 +1,9 @@ +from __future__ import absolute_import + from django.apps import AppConfig -from openedx.core.djangoapps.plugins.constants import ProjectType, PluginURLs +from openedx.core.djangoapps.plugins.constants import PluginURLs, ProjectType plugin_urls_config = {PluginURLs.NAMESPACE: u'theming', PluginURLs.REGEX: r'^theming/'} diff --git a/openedx/core/djangoapps/theming/checks.py b/openedx/core/djangoapps/theming/checks.py index bc6c12ba9f..fc0ecd9d1e 100644 --- a/openedx/core/djangoapps/theming/checks.py +++ b/openedx/core/djangoapps/theming/checks.py @@ -1,7 +1,10 @@ """ Settings validations for the theming app """ +from __future__ import absolute_import + import os + import six from django.conf import settings from django.core.checks import Error, Tags, register diff --git a/openedx/core/djangoapps/theming/finders.py b/openedx/core/djangoapps/theming/finders.py index 3247191265..b7d7db43a5 100644 --- a/openedx/core/djangoapps/theming/finders.py +++ b/openedx/core/djangoapps/theming/finders.py @@ -17,6 +17,8 @@ interface, as well. .. _Django-Pipeline: https://django-pipeline.readthedocs.org/ .. _Django-Require: https://github.com/etianen/django-require """ +from __future__ import absolute_import + import os from collections import OrderedDict diff --git a/openedx/core/djangoapps/theming/helpers.py b/openedx/core/djangoapps/theming/helpers.py index f65ceb4566..46a4df9573 100644 --- a/openedx/core/djangoapps/theming/helpers.py +++ b/openedx/core/djangoapps/theming/helpers.py @@ -4,6 +4,8 @@ Helpers for accessing comprehensive theming related variables. This file is imported at startup. Imports of models or things which import models will break startup on Django 1.9+. If you need models here, please import them inside the function which uses them. """ +from __future__ import absolute_import + import os import re from logging import getLogger diff --git a/openedx/core/djangoapps/theming/helpers_dirs.py b/openedx/core/djangoapps/theming/helpers_dirs.py index 7439aed5e9..73f8777bc1 100644 --- a/openedx/core/djangoapps/theming/helpers_dirs.py +++ b/openedx/core/djangoapps/theming/helpers_dirs.py @@ -2,7 +2,10 @@ Code which dynamically discovers comprehensive themes. Deliberately uses no Django settings, as the discovery happens during the initial setup of Django settings. """ +from __future__ import absolute_import + import os + from path import Path @@ -127,7 +130,8 @@ class Theme(object): return hash((self.theme_dir_name, self.path)) def __unicode__(self): - return u"".format(name=self.name, path=self.path) + # pylint: disable=line-too-long + return u"".format(name=self.name, path=self.path) # xss-lint: disable=python-wrap-html def __repr__(self): return self.__unicode__() diff --git a/openedx/core/djangoapps/theming/helpers_static.py b/openedx/core/djangoapps/theming/helpers_static.py index 9fc54c9e03..5dde345b16 100644 --- a/openedx/core/djangoapps/theming/helpers_static.py +++ b/openedx/core/djangoapps/theming/helpers_static.py @@ -1,4 +1,6 @@ +from __future__ import absolute_import + from django.contrib.staticfiles.storage import staticfiles_storage diff --git a/openedx/core/djangoapps/theming/management/commands/compile_sass.py b/openedx/core/djangoapps/theming/management/commands/compile_sass.py index 2cfe2ed0b5..db4b0221d6 100644 --- a/openedx/core/djangoapps/theming/management/commands/compile_sass.py +++ b/openedx/core/djangoapps/theming/management/commands/compile_sass.py @@ -5,11 +5,11 @@ Management command for compiling sass. from __future__ import absolute_import, unicode_literals import six - from django.core.management import BaseCommand, CommandError +from paver.easy import call_task + from openedx.core.djangoapps.theming.helpers import get_theme_base_dirs, get_themes, is_comprehensive_theming_enabled from pavelib.assets import ALL_SYSTEMS -from paver.easy import call_task class Command(BaseCommand): diff --git a/openedx/core/djangoapps/theming/management/commands/create_sites_and_configurations.py b/openedx/core/djangoapps/theming/management/commands/create_sites_and_configurations.py index 820fa91577..315adc6c3f 100644 --- a/openedx/core/djangoapps/theming/management/commands/create_sites_and_configurations.py +++ b/openedx/core/djangoapps/theming/management/commands/create_sites_and_configurations.py @@ -13,11 +13,12 @@ from django.contrib.auth.models import User from django.contrib.sites.models import Site from django.core.management.base import BaseCommand from edx_oauth2_provider.models import TrustedClient +from provider.constants import CONFIDENTIAL +from provider.oauth2.models import Client + from lms.djangoapps.commerce.models import CommerceConfiguration from openedx.core.djangoapps.site_configuration.models import SiteConfiguration from openedx.core.djangoapps.theming.models import SiteTheme -from provider.constants import CONFIDENTIAL -from provider.oauth2.models import Client from student.models import UserProfile LOG = logging.getLogger(__name__) diff --git a/openedx/core/djangoapps/theming/management/commands/tests/test_create_sites_and_configurations.py b/openedx/core/djangoapps/theming/management/commands/tests/test_create_sites_and_configurations.py index 68b6d79d58..565fc19849 100644 --- a/openedx/core/djangoapps/theming/management/commands/tests/test_create_sites_and_configurations.py +++ b/openedx/core/djangoapps/theming/management/commands/tests/test_create_sites_and_configurations.py @@ -10,8 +10,9 @@ from django.contrib.sites.models import Site from django.core.management import CommandError, call_command from django.test import TestCase from edx_oauth2_provider.models import TrustedClient -from openedx.core.djangoapps.theming.models import SiteTheme from provider.oauth2.models import Client + +from openedx.core.djangoapps.theming.models import SiteTheme from student.models import UserProfile SITES = ["site_a", "site_b"] diff --git a/openedx/core/djangoapps/theming/middleware.py b/openedx/core/djangoapps/theming/middleware.py index d2f25321e5..2f082a1fed 100644 --- a/openedx/core/djangoapps/theming/middleware.py +++ b/openedx/core/djangoapps/theming/middleware.py @@ -5,6 +5,8 @@ Note: This middleware depends on "django_sites_extensions" app So it must be added to INSTALLED_APPS in django settings files. """ +from __future__ import absolute_import + from django.conf import settings from .models import SiteTheme diff --git a/openedx/core/djangoapps/theming/models.py b/openedx/core/djangoapps/theming/models.py index e77e2860a3..04e77f6ebf 100644 --- a/openedx/core/djangoapps/theming/models.py +++ b/openedx/core/djangoapps/theming/models.py @@ -1,6 +1,8 @@ """ Django models supporting the Comprehensive Theming subsystem """ +from __future__ import absolute_import + from django.contrib.sites.models import Site from django.db import models diff --git a/openedx/core/djangoapps/theming/paver_helpers.py b/openedx/core/djangoapps/theming/paver_helpers.py index 52d7d1f2f0..06237a2403 100644 --- a/openedx/core/djangoapps/theming/paver_helpers.py +++ b/openedx/core/djangoapps/theming/paver_helpers.py @@ -2,7 +2,8 @@ This file contains helpers for paver commands, Django is not initialized in paver commands. So, django settings, models etc. can not be used here. """ -from __future__ import print_function +from __future__ import absolute_import, print_function + import os from path import Path diff --git a/openedx/core/djangoapps/theming/storage.py b/openedx/core/djangoapps/theming/storage.py index 268b80b52b..0a919c618f 100644 --- a/openedx/core/djangoapps/theming/storage.py +++ b/openedx/core/djangoapps/theming/storage.py @@ -2,6 +2,8 @@ Comprehensive Theming support for Django's collectstatic functionality. See https://docs.djangoproject.com/en/1.8/ref/contrib/staticfiles/ """ +from __future__ import absolute_import + import os.path import posixpath import re diff --git a/openedx/core/djangoapps/theming/template_loaders.py b/openedx/core/djangoapps/theming/template_loaders.py index a989b2f71c..6467faa298 100644 --- a/openedx/core/djangoapps/theming/template_loaders.py +++ b/openedx/core/djangoapps/theming/template_loaders.py @@ -1,6 +1,8 @@ """ Theming aware template loaders. """ +from __future__ import absolute_import + from django.template.loaders.filesystem import Loader as FilesystemLoader from edxmako.makoloader import MakoLoader diff --git a/openedx/core/djangoapps/theming/templatetags/theme_pipeline.py b/openedx/core/djangoapps/theming/templatetags/theme_pipeline.py index 1dc3ec4d3d..748adb0cff 100644 --- a/openedx/core/djangoapps/theming/templatetags/theme_pipeline.py +++ b/openedx/core/djangoapps/theming/templatetags/theme_pipeline.py @@ -7,10 +7,11 @@ from __future__ import absolute_import from django import template from django.template.loader import render_to_string from django.utils.safestring import mark_safe -from openedx.core.djangoapps.theming.helpers_static import get_static_file_url from pipeline.templatetags.pipeline import JavascriptNode, StylesheetNode from pipeline.utils import guess_type +from openedx.core.djangoapps.theming.helpers_static import get_static_file_url + register = template.Library() # pylint: disable=invalid-name diff --git a/openedx/core/djangoapps/theming/urls.py b/openedx/core/djangoapps/theming/urls.py index 6d6b1fd6fb..bba24e4caf 100644 --- a/openedx/core/djangoapps/theming/urls.py +++ b/openedx/core/djangoapps/theming/urls.py @@ -2,12 +2,13 @@ Defines URLs for theming views. """ +from __future__ import absolute_import + from django.conf.urls import url from .helpers import is_comprehensive_theming_enabled from .views import ThemingAdministrationFragmentView - if is_comprehensive_theming_enabled(): urlpatterns = [ url( diff --git a/openedx/core/djangoapps/theming/views.py b/openedx/core/djangoapps/theming/views.py index 19cbb6393f..80755e71e7 100644 --- a/openedx/core/djangoapps/theming/views.py +++ b/openedx/core/djangoapps/theming/views.py @@ -2,6 +2,8 @@ Views file for theming administration. """ +from __future__ import absolute_import + from django.conf import settings from django.contrib.auth.decorators import login_required from django.http import Http404 @@ -9,15 +11,16 @@ from django.shortcuts import redirect from django.template.loader import render_to_string from django.utils.decorators import method_decorator from django.utils.translation import ugettext as _ +from web_fragments.fragment import Fragment + from openedx.core.djangoapps.plugin_api.views import EdxFragmentView from openedx.core.djangoapps.user_api.preferences.api import ( delete_user_preference, get_user_preference, - set_user_preference, + set_user_preference ) from openedx.core.djangoapps.util.user_messages import PageLevelMessages from student.roles import GlobalStaff -from web_fragments.fragment import Fragment from .helpers import theme_exists from .models import SiteTheme