Commit 4859eee2 by Nimisha Asthagiri

Move modulestore django settings migration code down into the modulestore layer…

Move modulestore django settings migration code down into the modulestore layer so it works for all django-based callers.
parent a218e66d
...@@ -229,7 +229,7 @@ if AWS_SECRET_ACCESS_KEY == "": ...@@ -229,7 +229,7 @@ if AWS_SECRET_ACCESS_KEY == "":
AWS_SECRET_ACCESS_KEY = None AWS_SECRET_ACCESS_KEY = None
DATABASES = AUTH_TOKENS['DATABASES'] DATABASES = AUTH_TOKENS['DATABASES']
MODULESTORE = convert_module_store_setting_if_needed(AUTH_TOKENS['MODULESTORE']) MODULESTORE = AUTH_TOKENS.get('MODULESTORE', MODULESTORE)
CONTENTSTORE = AUTH_TOKENS['CONTENTSTORE'] CONTENTSTORE = AUTH_TOKENS['CONTENTSTORE']
DOC_STORE_CONFIG = AUTH_TOKENS['DOC_STORE_CONFIG'] DOC_STORE_CONFIG = AUTH_TOKENS['DOC_STORE_CONFIG']
# Datadog for events! # Datadog for events!
......
...@@ -30,11 +30,11 @@ import sys ...@@ -30,11 +30,11 @@ import sys
import lms.envs.common import lms.envs.common
# Although this module itself may not use these imported variables, other dependent modules may. # Although this module itself may not use these imported variables, other dependent modules may.
from lms.envs.common import ( from lms.envs.common import (
USE_TZ, TECH_SUPPORT_EMAIL, PLATFORM_NAME, BUGS_EMAIL, DOC_STORE_CONFIG, ALL_LANGUAGES, WIKI_ENABLED, MODULESTORE USE_TZ, TECH_SUPPORT_EMAIL, PLATFORM_NAME, BUGS_EMAIL, DOC_STORE_CONFIG, ALL_LANGUAGES, WIKI_ENABLED, MODULESTORE,
update_module_store_settings
) )
from path import path from path import path
from warnings import simplefilter from warnings import simplefilter
from lms.envs.modulestore_settings import *
from lms.lib.xblock.mixin import LmsBlockMixin from lms.lib.xblock.mixin import LmsBlockMixin
from dealer.git import git from dealer.git import git
......
...@@ -18,6 +18,7 @@ from xmodule.modulestore.loc_mapper_store import LocMapperStore ...@@ -18,6 +18,7 @@ from xmodule.modulestore.loc_mapper_store import LocMapperStore
from xmodule.util.django import get_current_request_hostname from xmodule.util.django import get_current_request_hostname
import xmodule.modulestore # pylint: disable=unused-import import xmodule.modulestore # pylint: disable=unused-import
from xmodule.contentstore.django import contentstore from xmodule.contentstore.django import contentstore
from xmodule.modulestore.modulestore_settings import convert_module_store_setting_if_needed
# We may not always have the request_cache module available # We may not always have the request_cache module available
try: try:
...@@ -85,6 +86,7 @@ def modulestore(): ...@@ -85,6 +86,7 @@ def modulestore():
""" """
global _MIXED_MODULESTORE # pylint: disable=global-statement global _MIXED_MODULESTORE # pylint: disable=global-statement
if _MIXED_MODULESTORE is None: if _MIXED_MODULESTORE is None:
settings.MODULESTORE = convert_module_store_setting_if_needed(settings.MODULESTORE)
_MIXED_MODULESTORE = create_modulestore_instance( _MIXED_MODULESTORE = create_modulestore_instance(
settings.MODULESTORE['default']['ENGINE'], settings.MODULESTORE['default']['ENGINE'],
contentstore(), contentstore(),
......
...@@ -3,7 +3,7 @@ Tests for testing the modulestore settings migration code. ...@@ -3,7 +3,7 @@ Tests for testing the modulestore settings migration code.
""" """
import copy import copy
from django.test import TestCase from django.test import TestCase
from lms.envs.modulestore_settings import convert_module_store_setting_if_needed from xmodule.modulestore.modulestore_settings import convert_module_store_setting_if_needed
class ModuleStoreSettingsMigration(TestCase): class ModuleStoreSettingsMigration(TestCase):
......
...@@ -324,7 +324,7 @@ XQUEUE_INTERFACE = AUTH_TOKENS['XQUEUE_INTERFACE'] ...@@ -324,7 +324,7 @@ XQUEUE_INTERFACE = AUTH_TOKENS['XQUEUE_INTERFACE']
# Get the MODULESTORE from auth.json, but if it doesn't exist, # Get the MODULESTORE from auth.json, but if it doesn't exist,
# use the one from common.py # use the one from common.py
MODULESTORE = convert_module_store_setting_if_needed(AUTH_TOKENS.get('MODULESTORE', MODULESTORE)) MODULESTORE = AUTH_TOKENS.get('MODULESTORE', MODULESTORE)
CONTENTSTORE = AUTH_TOKENS.get('CONTENTSTORE', CONTENTSTORE) CONTENTSTORE = AUTH_TOKENS.get('CONTENTSTORE', CONTENTSTORE)
DOC_STORE_CONFIG = AUTH_TOKENS.get('DOC_STORE_CONFIG', DOC_STORE_CONFIG) DOC_STORE_CONFIG = AUTH_TOKENS.get('DOC_STORE_CONFIG', DOC_STORE_CONFIG)
MONGODB_LOG = AUTH_TOKENS.get('MONGODB_LOG', {}) MONGODB_LOG = AUTH_TOKENS.get('MONGODB_LOG', {})
......
...@@ -33,7 +33,7 @@ from path import path ...@@ -33,7 +33,7 @@ from path import path
from warnings import simplefilter from warnings import simplefilter
from .discussionsettings import * from .discussionsettings import *
from .modulestore_settings import * from xmodule.modulestore.modulestore_settings import update_module_store_settings
from lms.lib.xblock.mixin import LmsBlockMixin from lms.lib.xblock.mixin import LmsBlockMixin
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment