Move modulestore django settings migration code down into the modulestore layer so it works for all django-based callers.

This commit is contained in:
Nimisha Asthagiri
2014-07-11 16:11:45 -04:00
parent a218e66d2e
commit 4859eee23b
7 changed files with 8 additions and 6 deletions

View File

@@ -229,7 +229,7 @@ if AWS_SECRET_ACCESS_KEY == "":
AWS_SECRET_ACCESS_KEY = None
DATABASES = AUTH_TOKENS['DATABASES']
MODULESTORE = convert_module_store_setting_if_needed(AUTH_TOKENS['MODULESTORE'])
MODULESTORE = AUTH_TOKENS.get('MODULESTORE', MODULESTORE)
CONTENTSTORE = AUTH_TOKENS['CONTENTSTORE']
DOC_STORE_CONFIG = AUTH_TOKENS['DOC_STORE_CONFIG']
# Datadog for events!

View File

@@ -30,11 +30,11 @@ import sys
import lms.envs.common
# Although this module itself may not use these imported variables, other dependent modules may.
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 warnings import simplefilter
from lms.envs.modulestore_settings import *
from lms.lib.xblock.mixin import LmsBlockMixin
from dealer.git import git

View File

@@ -18,6 +18,7 @@ from xmodule.modulestore.loc_mapper_store import LocMapperStore
from xmodule.util.django import get_current_request_hostname
import xmodule.modulestore # pylint: disable=unused-import
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
try:
@@ -85,6 +86,7 @@ def modulestore():
"""
global _MIXED_MODULESTORE # pylint: disable=global-statement
if _MIXED_MODULESTORE is None:
settings.MODULESTORE = convert_module_store_setting_if_needed(settings.MODULESTORE)
_MIXED_MODULESTORE = create_modulestore_instance(
settings.MODULESTORE['default']['ENGINE'],
contentstore(),

View File

@@ -3,7 +3,7 @@ Tests for testing the modulestore settings migration code.
"""
import copy
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):

View File

@@ -324,7 +324,7 @@ XQUEUE_INTERFACE = AUTH_TOKENS['XQUEUE_INTERFACE']
# Get the MODULESTORE from auth.json, but if it doesn't exist,
# 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)
DOC_STORE_CONFIG = AUTH_TOKENS.get('DOC_STORE_CONFIG', DOC_STORE_CONFIG)
MONGODB_LOG = AUTH_TOKENS.get('MONGODB_LOG', {})

View File

@@ -33,7 +33,7 @@ from path import path
from warnings import simplefilter
from .discussionsettings import *
from .modulestore_settings import *
from xmodule.modulestore.modulestore_settings import update_module_store_settings
from lms.lib.xblock.mixin import LmsBlockMixin