From 0a79b30ec40e14a664fad73e17c98b6ea85f0efc Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Fri, 7 Mar 2014 09:24:09 -0500 Subject: [PATCH] Delay import of xmodule packages until after sys.path fixup --- cms/djangoapps/contentstore/views/component.py | 1 - cms/envs/bok_choy.py | 5 ----- cms/envs/common.py | 7 ++++--- cms/envs/test.py | 5 ----- .../lib/xmodule/xmodule/modulestore/split_mongo/split.py | 1 - lms/envs/bok_choy.py | 5 ----- lms/envs/common.py | 7 ++++--- 7 files changed, 8 insertions(+), 23 deletions(-) diff --git a/cms/djangoapps/contentstore/views/component.py b/cms/djangoapps/contentstore/views/component.py index c1338d6230..ed955c1b32 100644 --- a/cms/djangoapps/contentstore/views/component.py +++ b/cms/djangoapps/contentstore/views/component.py @@ -23,7 +23,6 @@ from xblock.exceptions import NoSuchHandlerError from xblock.fields import Scope from xblock.plugin import PluginMissingError from xblock.runtime import Mixologist -from xmodule.x_module import prefer_xmodules from lms.lib.xblock.runtime import unquote_slashes diff --git a/cms/envs/bok_choy.py b/cms/envs/bok_choy.py index bc2a61a8ea..b088ccd880 100644 --- a/cms/envs/bok_choy.py +++ b/cms/envs/bok_choy.py @@ -16,8 +16,6 @@ os.environ['SERVICE_VARIANT'] = 'bok_choy' os.environ['CONFIG_ROOT'] = path(__file__).abspath().dirname() #pylint: disable=E1120 from .aws import * # pylint: disable=W0401, W0614 -from xmodule.x_module import prefer_xmodules - ######################### Testing overrides #################################### @@ -49,8 +47,5 @@ for log_name, log_level in LOG_OVERRIDES: # Use the auto_auth workflow for creating users and logging them in FEATURES['AUTOMATIC_AUTH_FOR_TESTING'] = True -# Enable XBlocks -XBLOCK_SELECT_FUNCTION = prefer_xmodules - # Unfortunately, we need to use debug mode to serve staticfiles DEBUG = True diff --git a/cms/envs/common.py b/cms/envs/common.py index 619863bd70..07fea0ed4e 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -34,9 +34,6 @@ from path import path from lms.lib.xblock.mixin import LmsBlockMixin from cms.lib.xblock.mixin import CmsBlockMixin -from xmodule.modulestore.inheritance import InheritanceMixin -from xmodule.modulestore import prefer_xmodules -from xmodule.x_module import XModuleMixin from dealer.git import git ############################ FEATURE CONFIGURATION ############################# @@ -220,6 +217,10 @@ X_FRAME_OPTIONS = 'ALLOW' ############# XBlock Configuration ########## +# Import after sys.path fixup +from xmodule.modulestore.inheritance import InheritanceMixin +from xmodule.x_module import XModuleMixin, prefer_xmodules + # This should be moved into an XBlock Runtime/Application object # once the responsibility of XBlock creation is moved out of modulestore - cpennington XBLOCK_MIXINS = (LmsBlockMixin, CmsBlockMixin, InheritanceMixin, XModuleMixin) diff --git a/cms/envs/test.py b/cms/envs/test.py index 8d60aff95c..64887e312c 100644 --- a/cms/envs/test.py +++ b/cms/envs/test.py @@ -157,11 +157,6 @@ INSTALLED_APPS += ('external_auth', ) filterwarnings('ignore', message='No request passed to the backend, unable to rate-limit') -################################# XBLOCK ###################################### -from xmodule.x_module import prefer_xmodules -XBLOCK_SELECT_FUNCTION = prefer_xmodules - - ################################# CELERY ###################################### CELERY_ALWAYS_EAGER = True diff --git a/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py b/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py index 2d717edd45..2f76703488 100644 --- a/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py +++ b/common/lib/xmodule/xmodule/modulestore/split_mongo/split.py @@ -56,7 +56,6 @@ import copy from pytz import UTC from xmodule.errortracker import null_error_tracker -from xmodule.x_module import prefer_xmodules from xmodule.modulestore.locator import ( BlockUsageLocator, DefinitionLocator, CourseLocator, VersionTree, LocalId, Locator ) diff --git a/lms/envs/bok_choy.py b/lms/envs/bok_choy.py index ae8f5bacf0..177bbdcdc4 100644 --- a/lms/envs/bok_choy.py +++ b/lms/envs/bok_choy.py @@ -4,8 +4,6 @@ Settings for bok choy tests import os from path import path -from xmodule.x_module import prefer_xmodules - CONFIG_ROOT = path(__file__).abspath().dirname() #pylint: disable=E1120 TEST_ROOT = CONFIG_ROOT.dirname().dirname() / "test_root" @@ -60,8 +58,5 @@ LOG_OVERRIDES = [ for log_name, log_level in LOG_OVERRIDES: logging.getLogger(log_name).setLevel(log_level) -# Enable XBlocks -XBLOCK_SELECT_FUNCTION = prefer_xmodules - # Unfortunately, we need to use debug mode to serve staticfiles DEBUG = True diff --git a/lms/envs/common.py b/lms/envs/common.py index 1d20f2c83e..ade8bc82e8 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -34,9 +34,6 @@ from path import path from .discussionsettings import * from lms.lib.xblock.mixin import LmsBlockMixin -from xmodule.modulestore.inheritance import InheritanceMixin -from xmodule.modulestore import prefer_xmodules -from xmodule.x_module import XModuleMixin ################################### FEATURES ################################### # The display name of the platform to be used in templates/emails/etc. @@ -433,6 +430,10 @@ DOC_STORE_CONFIG = { ############# XBlock Configuration ########## +# Import after sys.path fixup +from xmodule.modulestore.inheritance import InheritanceMixin +from xmodule.x_module import XModuleMixin, prefer_xmodules + # This should be moved into an XBlock Runtime/Application object # once the responsibility of XBlock creation is moved out of modulestore - cpennington XBLOCK_MIXINS = (LmsBlockMixin, InheritanceMixin, XModuleMixin)