Commit c9718380 by Chris Dodge Committed by Diana Huang

catch additional FEATURE['ENABLE_MKTG_SITE'] checks and make sure…

catch additional FEATURE['ENABLE_MKTG_SITE'] checks and make sure MicrositeConfigurations will override the global setting

one more faulty login regarding ENABLE_MKTG_SITE=true situations
parent 77a315c6
......@@ -37,13 +37,18 @@ def marketing_link(name):
# link_map maps URLs from the marketing site to the old equivalent on
# the Django site
link_map = settings.MKTG_URL_LINK_MAP
if settings.FEATURES.get('ENABLE_MKTG_SITE') and name in settings.MKTG_URLS:
enable_mktg_site = MicrositeConfiguration.get_microsite_configuration_value(
'ENABLE_MKTG_SITE',
settings.FEATURES.get('ENABLE_MKTG_SITE', False)
)
if enable_mktg_site and name in settings.MKTG_URLS:
# special case for when we only want the root marketing URL
if name == 'ROOT':
return settings.MKTG_URLS.get('ROOT')
return settings.MKTG_URLS.get('ROOT') + settings.MKTG_URLS.get(name)
# only link to the old pages when the marketing site isn't on
elif not settings.FEATURES.get('ENABLE_MKTG_SITE') and name in link_map:
elif not enable_mktg_site and name in link_map:
# don't try to reverse disabled marketing links
if link_map[name] is not None:
return reverse(link_map[name])
......
......@@ -59,7 +59,10 @@ def courses(request):
to that. Otherwise, if subdomain branding is on, this is the university
profile page. Otherwise, it's the edX courseware.views.courses page
"""
enable_mktg_site = settings.FEATURES.get('ENABLE_MKTG_SITE') or MicrositeConfiguration.get_microsite_configuration_value('ENABLE_MKTG_SITE', False)
enable_mktg_site = MicrositeConfiguration.get_microsite_configuration_value(
'ENABLE_MKTG_SITE',
settings.FEATURES.get('ENABLE_MKTG_SITE', False)
)
if enable_mktg_site:
return redirect(marketing_link('COURSES'), permanent=True)
......
......@@ -38,6 +38,8 @@ from xmodule.modulestore.search import path_to_location
from xmodule.course_module import CourseDescriptor
import shoppingcart
from microsite_configuration.middleware import MicrositeConfiguration
log = logging.getLogger("edx.courseware")
template_imports = {'urllib': urllib}
......@@ -514,7 +516,11 @@ def registered_for_course(course, user):
@ensure_csrf_cookie
@cache_if_anonymous
def course_about(request, course_id):
if settings.FEATURES.get('ENABLE_MKTG_SITE', False):
if MicrositeConfiguration.get_microsite_configuration_value(
'ENABLE_MKTG_SITE',
settings.FEATURES.get('ENABLE_MKTG_SITE', False)
):
raise Http404
course = get_course_with_access(request.user, course_id, 'see_exists')
......
......@@ -27,7 +27,7 @@ MICROSITE_CONFIGURATION = {
"course_index_overlay_text": "Explore free courses from leading universities.",
"course_index_overlay_logo_file": "openedx/images/header-logo.png",
"homepage_overlay_html": "<h1>Take an Open edX Course</h1>"
},
}
}
if len(MICROSITE_CONFIGURATION.keys()) > 0:
......@@ -36,3 +36,7 @@ if len(MICROSITE_CONFIGURATION.keys()) > 0:
SUBDOMAIN_BRANDING,
VIRTUAL_UNIVERSITIES
)
# pretend we are behind some marketing site, we want to be able to assert that the Microsite config values override
# this global setting
FEATURES['ENABLE_MKTG_SITE'] = True
......@@ -95,7 +95,7 @@ site_status_msg = get_site_status_msg(course_id)
% else:
<ol class="left nav-global">
<%block name="navigation_global_links">
% if settings.FEATURES.get('ENABLE_MKTG_SITE'):
% if MicrositeConfiguration.get_microsite_configuration_value('ENABLE_MKTG_SITE', settings.FEATURES.get('ENABLE_MKTG_SITE', False)):
<li class="nav-global-01">
<a href="${marketing_link('HOW_IT_WORKS')}">${_("How it Works")}</a>
</li>
......
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