diff --git a/cms/djangoapps/contentstore/context_processors.py b/cms/djangoapps/contentstore/context_processors.py deleted file mode 100644 index 082e52c654..0000000000 --- a/cms/djangoapps/contentstore/context_processors.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -Django Template Context Processor for CMS Online Contextual Help -""" -import ConfigParser -from django.conf import settings - -from util.help_context_processor import common_doc_url - - -# Open and parse the configuration file when the module is initialized -CONFIG_FILE = open(settings.REPO_ROOT / "docs" / "cms_config.ini") -CONFIG = ConfigParser.ConfigParser() -CONFIG.readfp(CONFIG_FILE) - - -def doc_url(request=None): # pylint: disable=unused-argument - """ - This function is added in the list of TEMPLATES 'context_processors' OPTION, which is a django setting for - a tuple of callables that take a request object as their argument and return a dictionary of items - to be merged into the RequestContext. - - This function returns a dict with get_online_help_info, making it directly available to all mako templates. - - Args: - request: Currently not used, but is passed by django to context processors. - May be used in the future for determining the language of choice. - """ - return common_doc_url(request, CONFIG) diff --git a/cms/envs/aws.py b/cms/envs/aws.py index 9285afe7e5..6de3003276 100644 --- a/cms/envs/aws.py +++ b/cms/envs/aws.py @@ -494,4 +494,4 @@ AFFILIATE_COOKIE_NAME = ENV_TOKENS.get('AFFILIATE_COOKIE_NAME', AFFILIATE_COOKIE ############## Settings for Studio Context Sensitive Help ############## -DOC_LINK_BASE_URL = ENV_TOKENS.get('DOC_LINK_BASE_URL', DOC_LINK_BASE_URL) +HELP_TOKENS_BOOKS = ENV_TOKENS.get('HELP_TOKENS_BOOKS', HELP_TOKENS_BOOKS) diff --git a/cms/envs/bok_choy.py b/cms/envs/bok_choy.py index ae848ac284..48d86f753c 100644 --- a/cms/envs/bok_choy.py +++ b/cms/envs/bok_choy.py @@ -13,6 +13,7 @@ from the same directory. import os from path import Path as path +from openedx.core.release import RELEASE_LINE ########################## Prod-like settings ################################### # These should be as close as possible to the settings we use in production. @@ -127,6 +128,12 @@ MOCK_SEARCH_BACKING_FILE = ( SECRET_KEY = "very_secret_bok_choy_key" LMS_ROOT_URL = "http://localhost:8000" +if RELEASE_LINE == "master": + # On master, acceptance tests use edX books, not the default Open edX books. + HELP_TOKENS_BOOKS = { + 'learner': 'http://edx.readthedocs.io/projects/edx-guide-for-students', + 'course_author': 'http://edx.readthedocs.io/projects/edx-partner-course-staff', + } ##################################################################### # Lastly, see if the developer has any local overrides. diff --git a/cms/envs/common.py b/cms/envs/common.py index eecd597497..da75b610a2 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -89,7 +89,8 @@ from lms.envs.common import ( FILE_UPLOAD_STORAGE_BUCKET_NAME, FILE_UPLOAD_STORAGE_PREFIX, - COURSE_ENROLLMENT_MODES + COURSE_ENROLLMENT_MODES, + HELP_TOKENS_BOOKS, ) from path import Path as path from warnings import simplefilter @@ -300,7 +301,7 @@ TEMPLATES = [ 'django.contrib.auth.context_processors.auth', # this is required for admin 'django.template.context_processors.csrf', 'dealer.contrib.django.staff.context_processor', # access git revision - 'contentstore.context_processors.doc_url', + 'help_tokens.context_processor', ), # Change 'debug' in your environment settings files - not here. 'debug': False @@ -1245,7 +1246,7 @@ AFFILIATE_COOKIE_NAME = 'affiliate_id' ############## Settings for Studio Context Sensitive Help ############## -DOC_LINK_BASE_URL = None +HELP_TOKENS_INI_FILE = REPO_ROOT / "docs" / "cms_config.ini" # Theme directory locale paths COMPREHENSIVE_THEME_LOCALE_PATHS = [] diff --git a/cms/startup.py b/cms/startup.py index c37f315433..47aa0560f9 100644 --- a/cms/startup.py +++ b/cms/startup.py @@ -12,6 +12,7 @@ from openedx.core.lib.django_startup import autostartup import django from openedx.core.djangoapps.monkey_patch import django_db_models_options from openedx.core.lib.xblock_utils import xblock_local_resource_url +from openedx.core.release import doc_version import xmodule.x_module import cms.lib.xblock.runtime @@ -45,6 +46,10 @@ def run(): xmodule.x_module.descriptor_global_handler_url = cms.lib.xblock.runtime.handler_url xmodule.x_module.descriptor_global_local_resource_url = xblock_local_resource_url + # Set the version of docs that help-tokens will go to. + settings.HELP_TOKENS_LANGUAGE_CODE = settings.LANGUAGE_CODE + settings.HELP_TOKENS_VERSION = doc_version() + # validate configurations on startup validate_cms_config(settings) diff --git a/cms/templates/widgets/header.html b/cms/templates/widgets/header.html index 763a75461a..595e217934 100644 --- a/cms/templates/widgets/header.html +++ b/cms/templates/widgets/header.html @@ -4,7 +4,6 @@ from django.conf import settings from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ - from contentstore.context_processors import doc_url %>