diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py
index fc0cca23f0..e68984ed5f 100644
--- a/cms/djangoapps/contentstore/views/course.py
+++ b/cms/djangoapps/contentstore/views/course.py
@@ -58,7 +58,6 @@ from course_action_state.managers import CourseActionStateItemNotFoundError
from course_action_state.models import CourseRerunState, CourseRerunUIStateManager
from course_creators.views import get_course_creator_status, add_user_with_status_unrequested
from edxmako.shortcuts import render_to_response
-from microsite_configuration import microsite
from models.settings.course_grading import CourseGradingModel
from models.settings.course_metadata import CourseMetadata
from models.settings.encoder import CourseSettingsEncoder
@@ -69,6 +68,7 @@ from openedx.core.djangoapps.models.course_details import CourseDetails
from openedx.core.djangoapps.programs.models import ProgramsApiConfig
from openedx.core.djangoapps.programs.utils import get_programs
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.lib.course_tabs import CourseTabPluginManager
from openedx.core.lib.courses import course_image_url
from openedx.core.djangolib.js_utils import dump_js_escaped_json
@@ -975,14 +975,14 @@ def settings_handler(request, course_key_string):
if 'text/html' in request.META.get('HTTP_ACCEPT', '') and request.method == 'GET':
upload_asset_url = reverse_course_url('assets_handler', course_key)
- # see if the ORG of this course can be attributed to a 'Microsite'. In that case, the
+ # see if the ORG of this course can be attributed to a defined configuration . In that case, the
# course about page should be editable in Studio
- marketing_site_enabled = microsite.get_value_for_org(
+ marketing_site_enabled = configuration_helpers.get_value_for_org(
course_module.location.org,
'ENABLE_MKTG_SITE',
settings.FEATURES.get('ENABLE_MKTG_SITE', False)
)
- enable_extended_course_details = microsite.get_value_for_org(
+ enable_extended_course_details = configuration_helpers.get_value_for_org(
course_module.location.org,
'ENABLE_EXTENDED_COURSE_DETAILS',
settings.FEATURES.get('ENABLE_EXTENDED_COURSE_DETAILS', False)
diff --git a/cms/djangoapps/contentstore/views/public.py b/cms/djangoapps/contentstore/views/public.py
index 98fcc9af0d..1a2ca08511 100644
--- a/cms/djangoapps/contentstore/views/public.py
+++ b/cms/djangoapps/contentstore/views/public.py
@@ -12,7 +12,7 @@ from edxmako.shortcuts import render_to_response
from external_auth.views import (ssl_login_shortcut, ssl_get_cert_from_request,
redirect_with_get)
-from microsite_configuration import microsite
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
__all__ = ['signup', 'login_page', 'howitworks']
@@ -61,7 +61,7 @@ def login_page(request):
{
'csrf': csrf_token,
'forgot_password_link': "//{base}/login#forgot-password-modal".format(base=settings.LMS_BASE),
- 'platform_name': microsite.get_value('platform_name', settings.PLATFORM_NAME),
+ 'platform_name': configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME),
}
)
diff --git a/cms/envs/test.py b/cms/envs/test.py
index bf3f5e2b0c..479739b964 100644
--- a/cms/envs/test.py
+++ b/cms/envs/test.py
@@ -223,54 +223,54 @@ FEATURES['EMBARGO'] = True
# set up some testing for microsites
FEATURES['USE_MICROSITES'] = True
-MICROSITE_ROOT_DIR = COMMON_ROOT / 'test' / 'test_microsites'
+MICROSITE_ROOT_DIR = COMMON_ROOT / 'test' / 'test_sites'
MICROSITE_CONFIGURATION = {
- "test_microsite": {
- "domain_prefix": "testmicrosite",
- "university": "test_microsite",
- "platform_name": "Test Microsite",
- "logo_image_url": "test_microsite/images/header-logo.png",
- "email_from_address": "test_microsite@edx.org",
- "payment_support_email": "test_microsite@edx.org",
+ "test_site": {
+ "domain_prefix": "test-site",
+ "university": "test_site",
+ "platform_name": "Test Site",
+ "logo_image_url": "test_site/images/header-logo.png",
+ "email_from_address": "test_site@edx.org",
+ "payment_support_email": "test_site@edx.org",
"ENABLE_MKTG_SITE": False,
- "SITE_NAME": "test_microsite.localhost",
- "course_org_filter": "TestMicrositeX",
+ "SITE_NAME": "test_site.localhost",
+ "course_org_filter": "TestSiteX",
"course_about_show_social_links": False,
- "css_overrides_file": "test_microsite/css/test_microsite.css",
+ "css_overrides_file": "test_site/css/test_site.css",
"show_partners": False,
"show_homepage_promo_video": False,
- "course_index_overlay_text": "This is a Test Microsite Overlay Text.",
- "course_index_overlay_logo_file": "test_microsite/images/header-logo.png",
- "homepage_overlay_html": "
This is a Test Microsite Overlay HTML ",
+ "course_index_overlay_text": "This is a Test Site Overlay Text.",
+ "course_index_overlay_logo_file": "test_site/images/header-logo.png",
+ "homepage_overlay_html": "This is a Test Site Overlay HTML ",
"ALWAYS_REDIRECT_HOMEPAGE_TO_DASHBOARD_FOR_AUTHENTICATED_USER": False,
"COURSE_CATALOG_VISIBILITY_PERMISSION": "see_in_catalog",
"COURSE_ABOUT_VISIBILITY_PERMISSION": "see_about_page",
"ENABLE_SHOPPING_CART": True,
"ENABLE_PAID_COURSE_REGISTRATION": True,
- "SESSION_COOKIE_DOMAIN": "test_microsite.localhost",
+ "SESSION_COOKIE_DOMAIN": "test_site.localhost",
"urls": {
- 'ABOUT': 'testmicrosite/about',
- 'PRIVACY': 'testmicrosite/privacy',
- 'TOS_AND_HONOR': 'testmicrosite/tos-and-honor',
+ 'ABOUT': 'test-site/about',
+ 'PRIVACY': 'test-site/privacy',
+ 'TOS_AND_HONOR': 'test-site/tos-and-honor',
},
},
- "microsite_with_logistration": {
+ "site_with_logistration": {
"domain_prefix": "logistration",
"university": "logistration",
"platform_name": "Test logistration",
- "logo_image_url": "test_microsite/images/header-logo.png",
- "email_from_address": "test_microsite@edx.org",
- "payment_support_email": "test_microsite@edx.org",
+ "logo_image_url": "test_site/images/header-logo.png",
+ "email_from_address": "test_site@edx.org",
+ "payment_support_email": "test_site@edx.org",
"ENABLE_MKTG_SITE": False,
"ENABLE_COMBINED_LOGIN_REGISTRATION": True,
- "SITE_NAME": "test_microsite.localhost",
+ "SITE_NAME": "test_site.localhost",
"course_org_filter": "LogistrationX",
"course_about_show_social_links": False,
- "css_overrides_file": "test_microsite/css/test_microsite.css",
+ "css_overrides_file": "test_site/css/test_site.css",
"show_partners": False,
"show_homepage_promo_video": False,
"course_index_overlay_text": "Logistration.",
- "course_index_overlay_logo_file": "test_microsite/images/header-logo.png",
+ "course_index_overlay_logo_file": "test_site/images/header-logo.png",
"homepage_overlay_html": "This is a Logistration HTML ",
"ALWAYS_REDIRECT_HOMEPAGE_TO_DASHBOARD_FOR_AUTHENTICATED_USER": False,
"COURSE_CATALOG_VISIBILITY_PERMISSION": "see_in_catalog",
@@ -284,7 +284,7 @@ MICROSITE_CONFIGURATION = {
"domain_prefix": "www",
}
}
-MICROSITE_TEST_HOSTNAME = 'testmicrosite.testserver'
+MICROSITE_TEST_HOSTNAME = 'test-site.testserver'
MICROSITE_LOGISTRATION_HOSTNAME = 'logistration.testserver'
TEST_THEME = COMMON_ROOT / "test" / "test-theme"
diff --git a/common/djangoapps/edxmako/shortcuts.py b/common/djangoapps/edxmako/shortcuts.py
index f1e32138d5..939b1ceccf 100644
--- a/common/djangoapps/edxmako/shortcuts.py
+++ b/common/djangoapps/edxmako/shortcuts.py
@@ -17,13 +17,13 @@ import logging
from django.http import HttpResponse
from django.template import Context
-from microsite_configuration import microsite
-
from edxmako import lookup_template
from edxmako.request_context import get_template_request_context
from django.conf import settings
from django.core.urlresolvers import reverse
-from openedx.core.djangoapps.theming.helpers import get_template_path
+from openedx.core.djangoapps.theming.helpers import get_template_path, is_request_in_themed_site
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
+
log = logging.getLogger(__name__)
@@ -38,7 +38,7 @@ 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
- enable_mktg_site = microsite.get_value(
+ enable_mktg_site = configuration_helpers.get_value(
'ENABLE_MKTG_SITE',
settings.FEATURES.get('ENABLE_MKTG_SITE', False)
)
@@ -71,7 +71,7 @@ def is_marketing_link_set(name):
Returns a boolean if a given named marketing link is configured.
"""
- enable_mktg_site = microsite.get_value(
+ enable_mktg_site = configuration_helpers.get_value(
'ENABLE_MKTG_SITE',
settings.FEATURES.get('ENABLE_MKTG_SITE', False)
)
@@ -102,13 +102,13 @@ def marketing_link_context_processor(request):
)
-def microsite_footer_context_processor(request):
+def footer_context_processor(request): # pylint: disable=unused-argument
"""
Checks the site name to determine whether to use the edX.org footer or the Open Source Footer.
"""
return dict(
[
- ("IS_REQUEST_IN_MICROSITE", microsite.is_request_in_microsite())
+ ("IS_REQUEST_IN_MICROSITE", is_request_in_themed_site())
]
)
diff --git a/common/djangoapps/microsite_configuration/__init__.py b/common/djangoapps/microsite_configuration/__init__.py
index cd0cc601f9..a7e50364d6 100644
--- a/common/djangoapps/microsite_configuration/__init__.py
+++ b/common/djangoapps/microsite_configuration/__init__.py
@@ -11,7 +11,6 @@ from microsite_configuration import settings
from django.conf import settings as base_settings
from microsite_configuration import microsite
-from .templatetags.microsite import page_title_breadcrumbs
class MicrositeAwareSettings(object):
diff --git a/common/djangoapps/microsite_configuration/context_processors.py b/common/djangoapps/microsite_configuration/context_processors.py
deleted file mode 100644
index af3ce1552b..0000000000
--- a/common/djangoapps/microsite_configuration/context_processors.py
+++ /dev/null
@@ -1,11 +0,0 @@
-""" Django template ontext processors. """
-
-from django.conf import settings
-
-from microsite_configuration import microsite
-
-
-def microsite_context(request): # pylint: disable=missing-docstring,unused-argument
- return {
- 'platform_name': microsite.get_value('platform_name', settings.PLATFORM_NAME)
- }
diff --git a/common/djangoapps/microsite_configuration/templatetags/__init__.py b/common/djangoapps/microsite_configuration/templatetags/__init__.py
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/common/djangoapps/microsite_configuration/tests/backends/test_filebased.py b/common/djangoapps/microsite_configuration/tests/backends/test_filebased.py
index 1931efee17..c1d978fd25 100644
--- a/common/djangoapps/microsite_configuration/tests/backends/test_filebased.py
+++ b/common/djangoapps/microsite_configuration/tests/backends/test_filebased.py
@@ -30,7 +30,7 @@ class FilebasedMicrositeBackendTests(TestCase):
"""
def setUp(self):
super(FilebasedMicrositeBackendTests, self).setUp()
- self.microsite_subdomain = 'testmicrosite'
+ self.microsite_subdomain = 'test-site'
def tearDown(self):
super(FilebasedMicrositeBackendTests, self).tearDown()
@@ -41,7 +41,7 @@ class FilebasedMicrositeBackendTests(TestCase):
Tests microsite.get_value works as expected.
"""
microsite.set_by_domain(self.microsite_subdomain)
- self.assertEqual(microsite.get_value('platform_name'), 'Test Microsite')
+ self.assertEqual(microsite.get_value('platform_name'), 'Test Site')
def test_is_request_in_microsite(self):
"""
@@ -63,15 +63,15 @@ class FilebasedMicrositeBackendTests(TestCase):
"""
microsite.set_by_domain(self.microsite_subdomain)
self.assertEqual(
- microsite.get_value_for_org('TestMicrositeX', 'platform_name'),
- 'Test Microsite'
+ microsite.get_value_for_org('TestSiteX', 'platform_name'),
+ 'Test Site'
)
# if no config is set
microsite.clear()
with patch('django.conf.settings.MICROSITE_CONFIGURATION', False):
self.assertEqual(
- microsite.get_value_for_org('TestMicrositeX', 'platform_name', 'Default Value'),
+ microsite.get_value_for_org('TestSiteX', 'platform_name', 'Default Value'),
'Default Value'
)
@@ -82,7 +82,7 @@ class FilebasedMicrositeBackendTests(TestCase):
microsite.set_by_domain(self.microsite_subdomain)
self.assertEqual(
microsite.get_all_orgs(),
- set(['TestMicrositeX', 'LogistrationX'])
+ set(['TestSiteX', 'LogistrationX'])
)
# if no config is set
@@ -100,7 +100,7 @@ class FilebasedMicrositeBackendTests(TestCase):
microsite.set_by_domain(self.microsite_subdomain)
self.assertEqual(
microsite.get_value('platform_name'),
- 'Test Microsite'
+ 'Test Site'
)
microsite.clear()
self.assertIsNone(microsite.get_value('platform_name'))
@@ -145,7 +145,7 @@ class FilebasedMicrositeTemplateBackendTests(ModuleStoreTestCase):
"""
def setUp(self):
super(FilebasedMicrositeTemplateBackendTests, self).setUp()
- self.microsite_subdomain = 'testmicrosite'
+ self.microsite_subdomain = 'test-site'
self.course = CourseFactory.create()
self.user = UserFactory.create(username="Bob", email="bob@example.com", password="edx")
self.client.login(username=self.user.username, password="edx")
diff --git a/common/djangoapps/microsite_configuration/tests/factories.py b/common/djangoapps/microsite_configuration/tests/factories.py
index 6594abfc7c..27e84b9a10 100644
--- a/common/djangoapps/microsite_configuration/tests/factories.py
+++ b/common/djangoapps/microsite_configuration/tests/factories.py
@@ -21,7 +21,7 @@ class SiteFactory(DjangoModelFactory):
model = Site
name = "test microsite"
- domain = "testmicrosite.testserver"
+ domain = "test-site.testserver"
class MicrositeFactory(DjangoModelFactory):
@@ -31,31 +31,31 @@ class MicrositeFactory(DjangoModelFactory):
class Meta(object):
model = Microsite
- key = "test_microsite"
+ key = "test_site"
site = factory.SubFactory(SiteFactory)
values = {
- "domain_prefix": "testmicrosite",
- "university": "test_microsite",
- "platform_name": "Test Microsite DB",
- "logo_image_url": "test_microsite/images/header-logo.png",
- "email_from_address": "test_microsite_db@edx.org",
- "payment_support_email": "test_microsit_dbe@edx.org",
+ "domain_prefix": "test-site",
+ "university": "test_site",
+ "platform_name": "Test Site DB",
+ "logo_image_url": "test_site/images/header-logo.png",
+ "email_from_address": "test_site@edx.org",
+ "payment_support_email": "test_site_dbe@edx.org",
"ENABLE_MKTG_SITE": False,
- "SITE_NAME": "test_microsite.localhost",
- "course_org_filter": "TestMicrositeX",
+ "SITE_NAME": "test_site.localhost",
+ "course_org_filter": "TestSiteX",
"course_about_show_social_links": False,
- "css_overrides_file": "test_microsite/css/test_microsite.css",
+ "css_overrides_file": "test_site/css/test_site.css",
"show_partners": False,
"show_homepage_promo_video": False,
- "course_index_overlay_text": "This is a Test Microsite Overlay Text.",
- "course_index_overlay_logo_file": "test_microsite/images/header-logo.png",
- "homepage_overlay_html": "This is a Test Microsite Overlay HTML ",
+ "course_index_overlay_text": "This is a Test Site Overlay Text.",
+ "course_index_overlay_logo_file": "test_site/images/header-logo.png",
+ "homepage_overlay_html": "This is a Test Site Overlay HTML ",
"ALWAYS_REDIRECT_HOMEPAGE_TO_DASHBOARD_FOR_AUTHENTICATED_USER": False,
"COURSE_CATALOG_VISIBILITY_PERMISSION": "see_in_catalog",
"COURSE_ABOUT_VISIBILITY_PERMISSION": "see_about_page",
"ENABLE_SHOPPING_CART": True,
"ENABLE_PAID_COURSE_REGISTRATION": True,
- "SESSION_COOKIE_DOMAIN": "test_microsite.localhost",
+ "SESSION_COOKIE_DOMAIN": "test_site.localhost",
"nested_dict": {
"key 1": "value 1",
"key 2": "value 2",
diff --git a/common/djangoapps/microsite_configuration/tests/test_admin.py b/common/djangoapps/microsite_configuration/tests/test_admin.py
index d32c64c36d..f3e1c68abc 100644
--- a/common/djangoapps/microsite_configuration/tests/test_admin.py
+++ b/common/djangoapps/microsite_configuration/tests/test_admin.py
@@ -35,8 +35,8 @@ class MicrositeAdminTests(DatabaseMicrositeTestCase):
Tests save action for Microsite model form.
"""
new_values = {
- "domain_prefix": "testmicrosite_new",
- "platform_name": "Test Microsite New"
+ "domain_prefix": "test-site-new",
+ "platform_name": "Test Site New"
}
microsite_form = self.microsite_admin.get_form(self.request)(instance=self.microsite, data={
"key": self.microsite.key,
diff --git a/common/djangoapps/microsite_configuration/tests/test_context_processors.py b/common/djangoapps/microsite_configuration/tests/test_context_processors.py
deleted file mode 100644
index 78de00aa22..0000000000
--- a/common/djangoapps/microsite_configuration/tests/test_context_processors.py
+++ /dev/null
@@ -1,22 +0,0 @@
-""" Tests for Django template context processors. """
-from django.test import TestCase
-from django.test.client import RequestFactory
-from django.test.utils import override_settings
-
-from microsite_configuration.context_processors import microsite_context
-
-PLATFORM_NAME = 'Test Platform'
-
-
-@override_settings(PLATFORM_NAME=PLATFORM_NAME)
-class MicrositeContextProcessorTests(TestCase):
- """ Tests for the microsite context processor. """
-
- def setUp(self):
- super(MicrositeContextProcessorTests, self).setUp()
- request = RequestFactory().get('/')
- self.context = microsite_context(request)
-
- def test_platform_name(self):
- """ Verify the context includes the platform name. """
- self.assertEqual(self.context['platform_name'], PLATFORM_NAME)
diff --git a/common/djangoapps/microsite_configuration/tests/test_logic.py b/common/djangoapps/microsite_configuration/tests/test_logic.py
index 26e22f546b..26259933d1 100644
--- a/common/djangoapps/microsite_configuration/tests/test_logic.py
+++ b/common/djangoapps/microsite_configuration/tests/test_logic.py
@@ -42,5 +42,5 @@ class TestMicrosites(DatabaseMicrositeTestCase):
"""
with patch('microsite_configuration.microsite.BACKEND',
get_backend(site_backend, BaseMicrositeBackend)):
- value = get_value_for_org("TestMicrositeX", "university", "default_value")
- self.assertEquals(value, "test_microsite")
+ value = get_value_for_org("TestSiteX", "university", "default_value")
+ self.assertEquals(value, "test_site")
diff --git a/common/djangoapps/microsite_configuration/tests/test_microsites.py b/common/djangoapps/microsite_configuration/tests/test_microsites.py
index 61520814f4..6073d09068 100644
--- a/common/djangoapps/microsite_configuration/tests/test_microsites.py
+++ b/common/djangoapps/microsite_configuration/tests/test_microsites.py
@@ -1,16 +1,17 @@
# -*- coding: utf-8 -*-
"""
-Tests microsite_configuration templatetags and helper functions.
+Tests configuration templatetags and helper functions.
"""
import logging
from mock import patch
from django.test import TestCase
from django.conf import settings
-from microsite_configuration.templatetags import microsite as microsite_tags
from microsite_configuration import microsite
from microsite_configuration.backends.base import BaseMicrositeBackend
from microsite_configuration.backends.database import DatabaseMicrositeBackend
+from openedx.core.djangoapps.site_configuration.templatetags import configuration as configuration_tags
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger(__name__)
@@ -22,30 +23,30 @@ class MicrositeTests(TestCase):
def test_breadcrumbs(self):
crumbs = ['my', 'less specific', 'Page']
expected = u'my | less specific | Page | edX'
- title = microsite_tags.page_title_breadcrumbs(*crumbs)
+ title = configuration_helpers.page_title_breadcrumbs(*crumbs)
self.assertEqual(expected, title)
def test_unicode_title(self):
crumbs = [u'øo', u'π tastes gréât', u'驴']
expected = u'øo | π tastes gréât | 驴 | edX'
- title = microsite_tags.page_title_breadcrumbs(*crumbs)
+ title = configuration_helpers.page_title_breadcrumbs(*crumbs)
self.assertEqual(expected, title)
def test_platform_name(self):
- pname = microsite_tags.platform_name()
+ pname = configuration_tags.platform_name()
self.assertEqual(pname, settings.PLATFORM_NAME)
def test_breadcrumb_tag(self):
crumbs = ['my', 'less specific', 'Page']
expected = u'my | less specific | Page | edX'
- title = microsite_tags.page_title_breadcrumbs_tag(None, *crumbs)
+ title = configuration_tags.page_title_breadcrumbs_tag(None, *crumbs)
self.assertEqual(expected, title)
def test_microsite_template_path(self):
"""
When an unexistent path is passed to the filter, it should return the same path
"""
- path = microsite_tags.microsite_template_path('footer.html')
+ path = configuration_tags.microsite_template_path('footer.html')
self.assertEqual("footer.html", path)
def test_get_backend_raise_error_for_invalid_class(self):
diff --git a/common/djangoapps/microsite_configuration/tests/test_middleware.py b/common/djangoapps/microsite_configuration/tests/test_middleware.py
index 47d6cd20ea..3b8753bff7 100644
--- a/common/djangoapps/microsite_configuration/tests/test_middleware.py
+++ b/common/djangoapps/microsite_configuration/tests/test_middleware.py
@@ -51,7 +51,7 @@ class MicrositeSessionCookieTests(DatabaseMicrositeTestCase):
with patch('microsite_configuration.microsite.BACKEND',
get_backend(site_backend, BaseMicrositeBackend)):
response = self.client.get('/')
- self.assertNotIn('test_microsite.localhost', str(response.cookies['sessionid']))
+ self.assertNotIn('test_site.localhost', str(response.cookies['sessionid']))
self.assertNotIn('Domain', str(response.cookies['sessionid']))
@ddt.data(*MICROSITE_BACKENDS)
@@ -63,7 +63,7 @@ class MicrositeSessionCookieTests(DatabaseMicrositeTestCase):
with patch('microsite_configuration.microsite.BACKEND',
get_backend(site_backend, BaseMicrositeBackend)):
response = self.client.get('/', HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
- self.assertIn('test_microsite.localhost', str(response.cookies['sessionid']))
+ self.assertIn('test_site.localhost', str(response.cookies['sessionid']))
@ddt.data(*MICROSITE_BACKENDS)
def test_microsite_none_cookie_domain(self, site_backend):
@@ -77,5 +77,5 @@ class MicrositeSessionCookieTests(DatabaseMicrositeTestCase):
with patch('microsite_configuration.microsite.BACKEND',
get_backend(site_backend, BaseMicrositeBackend)):
response = self.client.get('/', HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
- self.assertNotIn('test_microsite.localhost', str(response.cookies['sessionid']))
+ self.assertNotIn('test_site.localhost', str(response.cookies['sessionid']))
self.assertNotIn('Domain', str(response.cookies['sessionid']))
diff --git a/common/djangoapps/microsite_configuration/tests/tests.py b/common/djangoapps/microsite_configuration/tests/tests.py
index 616fe2ee3e..ef688ff1b8 100644
--- a/common/djangoapps/microsite_configuration/tests/tests.py
+++ b/common/djangoapps/microsite_configuration/tests/tests.py
@@ -22,7 +22,7 @@ class DatabaseMicrositeTestCase(TestCase):
def setUp(self):
super(DatabaseMicrositeTestCase, self).setUp()
self.microsite = MicrositeFactory.create()
- MicrositeOrganizationMappingFactory.create(microsite=self.microsite, organization='TestMicrositeX')
+ MicrositeOrganizationMappingFactory.create(microsite=self.microsite, organization='TestSiteX')
def side_effect_for_get_value(value, return_value):
diff --git a/common/djangoapps/pipeline_mako/templates/static_content.html b/common/djangoapps/pipeline_mako/templates/static_content.html
index 1f3a73788c..495d5ffa12 100644
--- a/common/djangoapps/pipeline_mako/templates/static_content.html
+++ b/common/djangoapps/pipeline_mako/templates/static_content.html
@@ -6,9 +6,12 @@ from django.utils.translation import get_language_bidi
from mako.exceptions import TemplateLookupException
from openedx.core.djangolib.js_utils import js_escaped_string
-from openedx.core.djangoapps.theming.helpers import (
- get_page_title_breadcrumbs,
+from openedx.core.djangoapps.site_configuration.helpers import (
+ page_title_breadcrumbs,
get_value,
+)
+
+from openedx.core.djangoapps.theming.helpers import (
get_template_path,
get_themed_template_path,
is_request_in_themed_site,
@@ -138,7 +141,7 @@ else:
<%def name="get_page_title_breadcrumbs(*args)"><%
- return get_page_title_breadcrumbs(*args)
+ return page_title_breadcrumbs(*args)
%>%def>
<%def name="get_platform_name()"><%
diff --git a/common/djangoapps/student/forms.py b/common/djangoapps/student/forms.py
index 93adc2107d..4da9fbc171 100644
--- a/common/djangoapps/student/forms.py
+++ b/common/djangoapps/student/forms.py
@@ -17,10 +17,9 @@ from django.utils.translation import ugettext_lazy as _
from django.template import loader
from django.conf import settings
-from microsite_configuration import microsite
from student.models import CourseEnrollmentAllowed
from util.password_policy_validators import validate_password_strength
-from openedx.core.djangoapps.theming import helpers as theming_helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
class PasswordResetFormNoActive(PasswordResetForm):
@@ -54,7 +53,7 @@ class PasswordResetFormNoActive(PasswordResetForm):
email_template_name='registration/password_reset_email.html',
use_https=False,
token_generator=default_token_generator,
- from_email=theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
+ from_email=configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
request=None
):
"""
@@ -66,7 +65,7 @@ class PasswordResetFormNoActive(PasswordResetForm):
from django.core.mail import send_mail
for user in self.users_cache:
if not domain_override:
- site_name = microsite.get_value(
+ site_name = configuration_helpers.get_value(
'SITE_NAME',
settings.SITE_NAME
)
@@ -79,7 +78,7 @@ class PasswordResetFormNoActive(PasswordResetForm):
'user': user,
'token': token_generator.make_token(user),
'protocol': 'https' if use_https else 'http',
- 'platform_name': microsite.get_value('platform_name', settings.PLATFORM_NAME)
+ 'platform_name': configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME)
}
subject = loader.render_to_string(subject_template_name, context)
# Email subject *must not* contain newlines
diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py
index 45bb422c6c..bbf6cd8480 100644
--- a/common/djangoapps/student/models.py
+++ b/common/djangoapps/student/models.py
@@ -51,10 +51,10 @@ from lms.djangoapps.badges.utils import badges_enabled
from certificates.models import GeneratedCertificate
from course_modes.models import CourseMode
from enrollment.api import _default_course_mode
-from microsite_configuration import microsite
import lms.lib.comment_client as cc
from openedx.core.djangoapps.commerce.utils import ecommerce_api_client, ECOMMERCE_DATE_FORMAT
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from util.model_utils import emit_field_changed_events, get_changed_fields_dict
from util.query import use_read_replica_if_available
from util.milestones_helpers import is_entrance_exams_enabled
@@ -1950,7 +1950,7 @@ class LinkedInAddToProfileConfiguration(ConfigurationModel):
target (str): An identifier for the occurrance of the button.
"""
- company_identifier = microsite.get_value('LINKEDIN_COMPANY_ID', self.company_identifier)
+ company_identifier = configuration_helpers.get_value('LINKEDIN_COMPANY_ID', self.company_identifier)
params = OrderedDict([
('_ed', company_identifier),
('pfCertificationName', self._cert_name(course_name, cert_mode).encode('utf-8')),
@@ -1972,7 +1972,7 @@ class LinkedInAddToProfileConfiguration(ConfigurationModel):
cert_mode,
_(u"{platform_name} Certificate for {course_name}")
).format(
- platform_name=microsite.get_value('platform_name', settings.PLATFORM_NAME),
+ platform_name=configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME),
course_name=course_name
)
diff --git a/common/djangoapps/student/tests/test_certificates.py b/common/djangoapps/student/tests/test_certificates.py
index a2b836ad6d..0408cee519 100644
--- a/common/djangoapps/student/tests/test_certificates.py
+++ b/common/djangoapps/student/tests/test_certificates.py
@@ -23,13 +23,6 @@ from student.models import LinkedInAddToProfileConfiguration
# pylint: disable=no-member
-def _fake_is_request_in_microsite():
- """
- Mocked version of microsite helper method to always return true
- """
- return True
-
-
class CertificateDisplayTestBase(SharedModuleStoreTestCase):
"""Tests display of certificates on the student dashboard. """
@@ -163,10 +156,10 @@ class CertificateDisplayTest(CertificateDisplayTestBase):
# now we should see it
self._check_linkedin_visibility(True)
- @mock.patch("microsite_configuration.microsite.is_request_in_microsite", _fake_is_request_in_microsite)
- def test_post_to_linkedin_microsite(self):
+ @mock.patch("openedx.core.djangoapps.theming.helpers.is_request_in_themed_site", mock.Mock(return_value=True))
+ def test_post_to_linkedin_site_specific(self):
"""
- Verifies behavior for microsites which disables the post to LinkedIn
+ Verifies behavior for themed sites which disables the post to LinkedIn
feature (for now)
"""
self._create_certificate('honor')
@@ -177,7 +170,7 @@ class CertificateDisplayTest(CertificateDisplayTestBase):
)
config.save()
- # now we should not see it because we are in a microsite
+ # now we should not see it because we are in a themed site
self._check_linkedin_visibility(False)
diff --git a/common/djangoapps/student/tests/test_microsite.py b/common/djangoapps/student/tests/test_configuration_overrides.py
similarity index 67%
rename from common/djangoapps/student/tests/test_microsite.py
rename to common/djangoapps/student/tests/test_configuration_overrides.py
index f68ab79654..279bfd21e3 100644
--- a/common/djangoapps/student/tests/test_microsite.py
+++ b/common/djangoapps/student/tests/test_configuration_overrides.py
@@ -1,5 +1,5 @@
"""
-Test for User Creation from Micro-Sites
+Test for user creation from sites with configuration overrides.
"""
from django.test import TestCase
from student.models import UserSignupSource
@@ -8,7 +8,7 @@ import json
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
-FAKE_MICROSITE = {
+FAKE_SITE = {
"SITE_NAME": "openedx.localhost",
"university": "fakeuniversity",
"course_org_filter": "fakeorg",
@@ -30,7 +30,7 @@ FAKE_MICROSITE = {
def fake_site_name(name, default=None):
"""
- create a fake microsite site name
+ Method for getting site name for a fake site.
"""
if name == 'SITE_NAME':
return 'openedx.localhost'
@@ -38,17 +38,17 @@ def fake_site_name(name, default=None):
return default
-def fake_microsite_get_value(name, default=None):
+def fake_get_value(name, default=None):
"""
- create a fake microsite site name
+ Method for getting configuration override values for a fake site.
"""
- return FAKE_MICROSITE.get(name, default)
+ return FAKE_SITE.get(name, default)
-class TestMicrosite(TestCase):
- """Test for Account Creation from a white labeled Micro-Sites"""
+class TestSite(TestCase):
+ """Test for Account Creation from white labeled Sites"""
def setUp(self):
- super(TestMicrosite, self).setUp()
+ super(TestSite, self).setUp()
self.username = "test_user"
self.url = reverse("create_account")
self.params = {
@@ -68,39 +68,39 @@ class TestMicrosite(TestCase):
"title": "foo"
}.items())
- @mock.patch("microsite_configuration.microsite.get_value", fake_site_name)
+ @mock.patch("openedx.core.djangoapps.site_configuration.helpers.get_value", fake_site_name)
def test_user_signup_source(self):
"""
- test to create a user form the microsite and see that it record has been
- saved in the UserSignupSource Table
+ Test to create a user from a site with configuration overrides and see that its record has been
+ saved in the UserSignupSource Table.
"""
response = self.client.post(self.url, self.params)
self.assertEqual(response.status_code, 200)
self.assertGreater(len(UserSignupSource.objects.filter(site='openedx.localhost')), 0)
- def test_user_signup_from_non_micro_site(self):
+ def test_user_signup_from_non_configured_site(self):
"""
- test to create a user form the non-microsite. The record should not be saved
- in the UserSignupSource Table
+ Test to create a user from a site without any configuration override. The record should not be saved
+ in UserSignupSource Table.
"""
response = self.client.post(self.url, self.params)
self.assertEqual(response.status_code, 200)
self.assertEqual(len(UserSignupSource.objects.filter(site='openedx.localhost')), 0)
- @mock.patch("microsite_configuration.microsite.get_value", fake_microsite_get_value)
+ @mock.patch("openedx.core.djangoapps.site_configuration.helpers.get_value", fake_get_value)
def test_user_signup_missing_enhanced_profile(self):
"""
- test to create a user form the microsite but don't provide any of the microsite specific
- profile information
+ Test to create a user from a site with configuration overrides but don't provide any overrides for
+ profile information.
"""
response = self.client.post(self.url, self.params)
self.assertEqual(response.status_code, 400)
- @mock.patch("microsite_configuration.microsite.get_value", fake_microsite_get_value)
+ @mock.patch("openedx.core.djangoapps.site_configuration.helpers.get_value", fake_get_value)
def test_user_signup_including_enhanced_profile(self):
"""
- test to create a user form the microsite but don't provide any of the microsite specific
- profile information
+ Test to create a user from a site with configuration overrides with overrides for
+ profile information.
"""
response = self.client.post(self.url, self.extended_params)
self.assertEqual(response.status_code, 200)
diff --git a/common/djangoapps/student/tests/test_email.py b/common/djangoapps/student/tests/test_email.py
index 2dbd30625e..f13db30564 100644
--- a/common/djangoapps/student/tests/test_email.py
+++ b/common/djangoapps/student/tests/test_email.py
@@ -20,7 +20,7 @@ from django.conf import settings
from edxmako.shortcuts import render_to_string
from util.request import safe_get_host
from util.testing import EventTestMixin
-from openedx.core.djangoapps.theming import helpers as theming_helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme
@@ -57,7 +57,7 @@ class EmailTestMixin(object):
email_user.assert_called_with(
mock_render_to_string(subject_template, subject_context),
mock_render_to_string(body_template, body_context),
- theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
+ configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
)
def append_allowed_hosts(self, hostname):
@@ -298,7 +298,7 @@ class EmailChangeRequestTests(EventTestMixin, TestCase):
send_mail.assert_called_with(
mock_render_to_string('emails/email_change_subject.txt', context),
mock_render_to_string('emails/email_change.txt', context),
- theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
+ configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
[new_email]
)
self.assert_event_emitted(
diff --git a/common/djangoapps/student/tests/test_reset_password.py b/common/djangoapps/student/tests/test_reset_password.py
index 927b281c57..6b3b61ed58 100644
--- a/common/djangoapps/student/tests/test_reset_password.py
+++ b/common/djangoapps/student/tests/test_reset_password.py
@@ -25,8 +25,8 @@ from student.tests.factories import UserFactory
from student.tests.test_email import mock_render_to_string
from util.testing import EventTestMixin
-from .test_microsite import fake_microsite_get_value
-from openedx.core.djangoapps.theming import helpers as theming_helpers
+from .test_configuration_overrides import fake_get_value
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
@unittest.skipUnless(
@@ -125,7 +125,7 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase):
(subject, msg, from_addr, to_addrs) = send_email.call_args[0]
self.assertIn("Password reset", subject)
self.assertIn("You're receiving this e-mail because you requested a password reset", msg)
- self.assertEquals(from_addr, theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL))
+ self.assertEquals(from_addr, configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL))
self.assertEquals(len(to_addrs), 1)
self.assertIn(self.user.email, to_addrs)
@@ -195,9 +195,9 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase):
)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', "Test only valid in LMS")
- @patch("microsite_configuration.microsite.get_value", fake_microsite_get_value)
+ @patch("openedx.core.djangoapps.site_configuration.helpers.get_value", fake_get_value)
@patch('django.core.mail.send_mail')
- def test_reset_password_email_microsite(self, send_email):
+ def test_reset_password_email_configuration_override(self, send_email):
"""
Tests that the right url domain and platform name is included in
the reset password email
@@ -254,9 +254,9 @@ class ResetPasswordTests(EventTestMixin, CacheIsolationTestCase):
self.assertTrue(self.user.is_active)
@patch('student.views.password_reset_confirm')
- @patch("microsite_configuration.microsite.get_value", fake_microsite_get_value)
- def test_reset_password_good_token_microsite(self, reset_confirm):
- """Tests password reset confirmation page for micro site"""
+ @patch("openedx.core.djangoapps.site_configuration.helpers.get_value", fake_get_value)
+ def test_reset_password_good_token_configuration_override(self, reset_confirm):
+ """Tests password reset confirmation page for site configuration override."""
url = reverse(
"password_reset_confirm",
kwargs={"uidb36": self.uidb36, "token": self.token}
diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py
index b3754dd1ca..2b7779073a 100644
--- a/common/djangoapps/student/views.py
+++ b/common/djangoapps/student/views.py
@@ -97,7 +97,6 @@ from util.bad_request_rate_limiter import BadRequestRateLimiter
from util.milestones_helpers import (
get_pre_requisite_courses_not_completed,
)
-from microsite_configuration import microsite
from util.password_policy_validators import validate_password_strength
import third_party_auth
@@ -123,6 +122,7 @@ from openedx.core.djangoapps.credit.email_utils import get_credit_provider_displ
from openedx.core.djangoapps.user_api.preferences import api as preferences_api
from openedx.core.djangoapps.programs.utils import get_programs_for_dashboard, get_display_category
from openedx.core.djangoapps.programs.models import ProgramsApiConfig
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.theming import helpers as theming_helpers
@@ -164,31 +164,33 @@ def index(request, extra_context=None, user=AnonymousUser()):
courses = get_courses(user)
- if microsite.get_value("ENABLE_COURSE_SORTING_BY_START_DATE",
- settings.FEATURES["ENABLE_COURSE_SORTING_BY_START_DATE"]):
+ if configuration_helpers.get_value(
+ "ENABLE_COURSE_SORTING_BY_START_DATE",
+ settings.FEATURES["ENABLE_COURSE_SORTING_BY_START_DATE"],
+ ):
courses = sort_by_start_date(courses)
else:
courses = sort_by_announcement(courses)
context = {'courses': courses}
- context['homepage_overlay_html'] = microsite.get_value('homepage_overlay_html')
+ context['homepage_overlay_html'] = configuration_helpers.get_value('homepage_overlay_html')
# This appears to be an unused context parameter, at least for the master templates...
- context['show_partners'] = microsite.get_value('show_partners', True)
+ context['show_partners'] = configuration_helpers.get_value('show_partners', True)
# TO DISPLAY A YOUTUBE WELCOME VIDEO
# 1) Change False to True
- context['show_homepage_promo_video'] = microsite.get_value('show_homepage_promo_video', False)
+ context['show_homepage_promo_video'] = configuration_helpers.get_value('show_homepage_promo_video', False)
- # 2) Add your video's YouTube ID (11 chars, eg "123456789xX"), or specify via microsite config
+ # 2) Add your video's YouTube ID (11 chars, eg "123456789xX"), or specify via site configuration
# Note: This value should be moved into a configuration setting and plumbed-through to the
- # context via the microsite configuration workflow, versus living here
- youtube_video_id = microsite.get_value('homepage_promo_video_youtube_id', "your-youtube-id")
+ # context via the site configuration workflow, versus living here
+ youtube_video_id = configuration_helpers.get_value('homepage_promo_video_youtube_id', "your-youtube-id")
context['homepage_promo_video_youtube_id'] = youtube_video_id
- # allow for microsite override of the courses list
- context['courses_list'] = microsite.get_template_path('courses_list.html')
+ # allow for theme override of the courses list
+ context['courses_list'] = theming_helpers.get_template_path('courses_list.html')
# Insert additional context for use in the template
context.update(extra_context)
@@ -264,8 +266,7 @@ def get_course_enrollments(user, org_to_include, orgs_to_exclude):
Arguments:
user (User): the user in question.
- org_to_include (str): for use in Microsites. If not None, ONLY courses
- of this org will be returned.
+ org_to_include (str): If not None, ONLY courses of this org will be returned.
orgs_to_exclude (list[str]): If org_to_include is not None, this
argument is ignored. Else, courses of this org will be excluded.
@@ -285,13 +286,11 @@ def get_course_enrollments(user, org_to_include, orgs_to_exclude):
)
continue
- # If we are in a Microsite, then filter out anything that is not
- # attributed (by ORG) to that Microsite.
+ # Filter out anything that is not attributed to the current ORG.
if org_to_include and course_overview.location.org != org_to_include:
continue
- # Conversely, if we are not in a Microsite, then filter out any enrollments
- # with courses attributed (by ORG) to Microsites.
+ # Conversely, filter out any enrollments with courses attributed to current ORG.
elif course_overview.location.org in orgs_to_exclude:
continue
@@ -385,8 +384,8 @@ def _cert_info(user, course_overview, cert_status, course_mode): # pylint: disa
linkedin_config = LinkedInAddToProfileConfiguration.current()
# posting certificates to LinkedIn is not currently
- # supported in microsites/White Labels
- if linkedin_config.enabled and not microsite.is_request_in_microsite():
+ # supported in White Labels
+ if linkedin_config.enabled and not theming_helpers.is_request_in_themed_site():
status_dict['linked_in_url'] = linkedin_config.add_to_profile_url(
course_overview.id,
course_overview.display_name,
@@ -431,7 +430,7 @@ def signin_user(request):
# pipeline, if any.
'pipeline_running': 'true' if pipeline.running(request) else 'false',
'pipeline_url': auth_pipeline_urls(pipeline.AUTH_ENTRY_LOGIN, redirect_url=redirect_to),
- 'platform_name': microsite.get_value(
+ 'platform_name': configuration_helpers.get_value(
'platform_name',
settings.PLATFORM_NAME
),
@@ -459,7 +458,7 @@ def register_user(request, extra_context=None):
'name': '',
'running_pipeline': None,
'pipeline_urls': auth_pipeline_urls(pipeline.AUTH_ENTRY_REGISTER, redirect_url=redirect_to),
- 'platform_name': microsite.get_value(
+ 'platform_name': configuration_helpers.get_value(
'platform_name',
settings.PLATFORM_NAME
),
@@ -548,17 +547,17 @@ def is_course_blocked(request, redeemed_registration_codes, course_key):
def dashboard(request):
user = request.user
- platform_name = microsite.get_value("platform_name", settings.PLATFORM_NAME)
+ platform_name = configuration_helpers.get_value("platform_name", settings.PLATFORM_NAME)
- # for microsites, we want to filter and only show enrollments for courses within
- # the microsites 'ORG'
- course_org_filter = microsite.get_value('course_org_filter')
+ # we want to filter and only show enrollments for courses within
+ # the 'ORG' defined in configuration.
+ course_org_filter = configuration_helpers.get_value('course_org_filter')
# Let's filter out any courses in an "org" that has been declared to be
- # in a Microsite
- org_filter_out_set = microsite.get_all_orgs()
+ # in a configuration
+ org_filter_out_set = configuration_helpers.get_all_orgs()
- # remove our current Microsite from the "filter out" list, if applicable
+ # remove our current org from the "filter out" list, if applicable
if course_org_filter:
org_filter_out_set.remove(course_org_filter)
@@ -780,7 +779,7 @@ def _create_recent_enrollment_message(course_enrollments, course_modes): # pyli
for enrollment in recently_enrolled_courses
]
- platform_name = microsite.get_value('platform_name', settings.PLATFORM_NAME)
+ platform_name = configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME)
return render_to_string(
'enrollment/course_enrollment_message.html',
@@ -1122,7 +1121,7 @@ def login_user(request, error=""): # pylint: disable=too-many-statements,unused
third_party_auth_successful = False
trumped_by_first_party_auth = bool(request.POST.get('email')) or bool(request.POST.get('password'))
user = None
- platform_name = microsite.get_value("platform_name", settings.PLATFORM_NAME)
+ platform_name = configuration_helpers.get_value("platform_name", settings.PLATFORM_NAME)
if third_party_auth_requested and not trumped_by_first_party_auth:
# The user has already authenticated via third-party auth and has not
@@ -1475,7 +1474,7 @@ def user_signup_handler(sender, **kwargs): # pylint: disable=unused-argument
when the user is created
"""
if 'created' in kwargs and kwargs['created']:
- site = microsite.get_value('SITE_NAME')
+ site = configuration_helpers.get_value('SITE_NAME')
if site:
user_signup_source = UserSignupSource(user=kwargs['instance'], site=site)
user_signup_source.save()
@@ -1589,8 +1588,8 @@ def create_account_with_params(request, params):
# params is request.POST, that results in a dict containing lists of values
params = dict(params.items())
- # allow for microsites to define their own set of required/optional/hidden fields
- extra_fields = microsite.get_value(
+ # allow to define custom set of required/optional/hidden fields via configuration
+ extra_fields = configuration_helpers.get_value(
'REGISTRATION_EXTRA_FIELDS',
getattr(settings, 'REGISTRATION_EXTRA_FIELDS', {})
)
@@ -1622,7 +1621,7 @@ def create_account_with_params(request, params):
params["password"] = eamap.internal_password
log.debug(u'In create_account with external_auth: user = %s, email=%s', params["name"], params["email"])
- extended_profile_fields = microsite.get_value('extended_profile_fields', [])
+ extended_profile_fields = configuration_helpers.get_value('extended_profile_fields', [])
enforce_password_policy = (
settings.FEATURES.get("ENFORCE_PASSWORD_POLICY", False) and
not do_external_auth
@@ -1786,7 +1785,7 @@ def create_account_with_params(request, params):
subject = ''.join(subject.splitlines())
message = render_to_string('emails/activation_email.txt', context)
- from_address = theming_helpers.get_value(
+ from_address = configuration_helpers.get_value(
'email_from_address',
settings.DEFAULT_FROM_EMAIL
)
@@ -2095,7 +2094,7 @@ def password_reset(request):
form = PasswordResetFormNoActive(request.POST)
if form.is_valid():
form.save(use_https=request.is_secure(),
- from_email=theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
+ from_email=configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
request=request,
domain_override=request.get_host())
# When password change is complete, a "edx.user.settings.changed" event will be emitted.
@@ -2199,7 +2198,7 @@ def password_reset_confirm_wrapper(request, uidb36=None, token=None):
# convert old-style base36-encoded user id to base64
uidb64 = uidb36_to_uidb64(uidb36)
platform_name = {
- "platform_name": microsite.get_value('platform_name', settings.PLATFORM_NAME)
+ "platform_name": configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME)
}
try:
uid_int = base36_to_int(uidb36)
@@ -2276,11 +2275,14 @@ def reactivation_email_for_user(user):
message = render_to_string('emails/activation_email.txt', context)
try:
- user.email_user(subject, message, theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL))
+ user.email_user(subject, message, configuration_helpers.get_value(
+ 'email_from_address',
+ settings.DEFAULT_FROM_EMAIL,
+ ))
except Exception: # pylint: disable=broad-except
log.error(
u'Unable to send reactivation email from "%s"',
- theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
+ configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
exc_info=True
)
return JsonResponse({
@@ -2340,7 +2342,7 @@ def do_email_change_request(user, new_email, activation_key=None):
message = render_to_string('emails/email_change.txt', context)
- from_address = theming_helpers.get_value(
+ from_address = configuration_helpers.get_value(
'email_from_address',
settings.DEFAULT_FROM_EMAIL
)
@@ -2404,7 +2406,7 @@ def confirm_email_change(request, key): # pylint: disable=unused-argument
user.email_user(
subject,
message,
- theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
+ configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
)
except Exception: # pylint: disable=broad-except
log.warning('Unable to send confirmation email to old address', exc_info=True)
@@ -2420,7 +2422,7 @@ def confirm_email_change(request, key): # pylint: disable=unused-argument
user.email_user(
subject,
message,
- theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
+ configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
)
except Exception: # pylint: disable=broad-except
log.warning('Unable to send confirmation email to new address', exc_info=True)
diff --git a/common/djangoapps/third_party_auth/__init__.py b/common/djangoapps/third_party_auth/__init__.py
index c30f0076fa..8646ed434c 100644
--- a/common/djangoapps/third_party_auth/__init__.py
+++ b/common/djangoapps/third_party_auth/__init__.py
@@ -1,6 +1,6 @@
"""Third party authentication. """
-from microsite_configuration import microsite
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
def is_enabled():
@@ -9,7 +9,7 @@ def is_enabled():
# We do this import internally to avoid initializing settings prematurely
from django.conf import settings
- return microsite.get_value(
+ return configuration_helpers.get_value(
"ENABLE_THIRD_PARTY_AUTH",
settings.FEATURES.get("ENABLE_THIRD_PARTY_AUTH")
)
diff --git a/common/djangoapps/third_party_auth/models.py b/common/djangoapps/third_party_auth/models.py
index 5bd8f22200..3ad90108f6 100644
--- a/common/djangoapps/third_party_auth/models.py
+++ b/common/djangoapps/third_party_auth/models.py
@@ -21,7 +21,7 @@ from social.backends.saml import SAMLAuth, SAMLIdentityProvider
from .lti import LTIAuthBackend, LTI_PARAMS_KEY
from social.exceptions import SocialAuthBaseException
from social.utils import module_member
-from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger(__name__)
@@ -454,7 +454,9 @@ class SAMLConfiguration(ConfigurationModel):
other_config = json.loads(self.other_config_str)
if name in ("TECHNICAL_CONTACT", "SUPPORT_CONTACT"):
contact = {
- "givenName": "{} Support".format(get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)),
+ "givenName": "{} Support".format(
+ configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ ),
"emailAddress": settings.TECH_SUPPORT_EMAIL
}
contact.update(other_config.get(name, {}))
diff --git a/common/djangoapps/util/request.py b/common/djangoapps/util/request.py
index 922d0c25e1..63befd8be9 100644
--- a/common/djangoapps/util/request.py
+++ b/common/djangoapps/util/request.py
@@ -3,9 +3,9 @@ import re
from django.conf import settings
-from microsite_configuration import microsite
from opaque_keys import InvalidKeyError
from opaque_keys.edx.locations import SlashSeparatedCourseKey
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
# accommodates course api urls, excluding any course api routes that do not fall under v*/courses, such as v1/blocks.
COURSE_REGEX = re.compile(r'^(.*?/courses/)(?!v[0-9]+/[^/]+){}'.format(settings.COURSE_ID_PATTERN))
@@ -23,7 +23,7 @@ def safe_get_host(request):
if isinstance(settings.ALLOWED_HOSTS, (list, tuple)) and '*' not in settings.ALLOWED_HOSTS:
return request.get_host()
else:
- return microsite.get_value('site_domain', settings.SITE_NAME)
+ return configuration_helpers.get_value('site_domain', settings.SITE_NAME)
def course_id_from_url(url):
diff --git a/common/djangoapps/util/tests/test_submit_feedback.py b/common/djangoapps/util/tests/test_submit_feedback.py
index 996db59e15..9a36838505 100644
--- a/common/djangoapps/util/tests/test_submit_feedback.py
+++ b/common/djangoapps/util/tests/test_submit_feedback.py
@@ -11,7 +11,7 @@ from zendesk import ZendeskError
import json
import mock
-from student.tests.test_microsite import fake_microsite_get_value
+from student.tests.test_configuration_overrides import fake_get_value
@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_FEEDBACK_SUBMISSION": True})
@@ -193,14 +193,14 @@ class SubmitFeedbackTest(TestCase):
self.assertEqual(zendesk_mock_instance.mock_calls, expected_zendesk_calls)
self._assert_datadog_called(datadog_mock, with_tags=True)
- @mock.patch("microsite_configuration.microsite.get_value", fake_microsite_get_value)
- def test_valid_request_anon_user_microsite(self, zendesk_mock_class, datadog_mock):
+ @mock.patch("openedx.core.djangoapps.site_configuration.helpers.get_value", fake_get_value)
+ def test_valid_request_anon_user_configuration_override(self, zendesk_mock_class, datadog_mock):
"""
- Test a valid request from an anonymous user to a mocked out microsite
+ Test a valid request from an anonymous user to a mocked out site with configuration override
The response should have a 200 (success) status code, and a ticket with
the given information should have been submitted via the Zendesk API with the additional
- tag that will come from microsite configuration
+ tag that will come from site configuration override.
"""
zendesk_mock_instance = zendesk_mock_class.return_value
zendesk_mock_instance.create_ticket.return_value = 42
diff --git a/common/djangoapps/util/views.py b/common/djangoapps/util/views.py
index 1c3e9fe1f9..6493186fff 100644
--- a/common/djangoapps/util/views.py
+++ b/common/djangoapps/util/views.py
@@ -14,7 +14,7 @@ from django.http import (Http404, HttpResponse, HttpResponseNotAllowed,
import dogstats_wrapper as dog_stats_api
from edxmako.shortcuts import render_to_response
import zendesk
-from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
import calc
import track.views
@@ -233,7 +233,7 @@ def _record_feedback_in_zendesk(
# Per edX support, we would like to be able to route white label feedback items
# via tagging
- white_label_org = get_themed_value('course_org_filter')
+ white_label_org = configuration_helpers.get_value('course_org_filter')
if white_label_org:
zendesk_tags = zendesk_tags + ["whitelabel_{org}".format(org=white_label_org)]
@@ -368,7 +368,7 @@ def submit_feedback(request):
details,
tags,
additional_info,
- support_email=get_themed_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
+ support_email=configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
)
_record_feedback_in_datadog(tags)
diff --git a/common/test/test_microsites/test_microsite/templates/static_templates/copyright.html b/common/test/test_microsites/test_microsite/templates/static_templates/copyright.html
deleted file mode 100755
index d24c6dab67..0000000000
--- a/common/test/test_microsites/test_microsite/templates/static_templates/copyright.html
+++ /dev/null
@@ -1 +0,0 @@
-This is a copyright page for an Open edX microsite.
diff --git a/common/test/test_microsites/default/readme.txt b/common/test/test_sites/default/readme.txt
similarity index 100%
rename from common/test/test_microsites/default/readme.txt
rename to common/test/test_sites/default/readme.txt
diff --git a/common/test/test_microsites/microsite_with_logistration/readme.txt b/common/test/test_sites/site_with_logistration/readme.txt
similarity index 100%
rename from common/test/test_microsites/microsite_with_logistration/readme.txt
rename to common/test/test_sites/site_with_logistration/readme.txt
diff --git a/common/test/test_microsites/test_microsite/css/test_microsite.css b/common/test/test_sites/test_site/css/test_site.css
similarity index 100%
rename from common/test/test_microsites/test_microsite/css/test_microsite.css
rename to common/test/test_sites/test_site/css/test_site.css
diff --git a/common/test/test_microsites/test_microsite/images/background-image.jpg b/common/test/test_sites/test_site/images/background-image.jpg
similarity index 100%
rename from common/test/test_microsites/test_microsite/images/background-image.jpg
rename to common/test/test_sites/test_site/images/background-image.jpg
diff --git a/common/test/test_microsites/test_microsite/images/header-logo.png b/common/test/test_sites/test_site/images/header-logo.png
similarity index 100%
rename from common/test/test_microsites/test_microsite/images/header-logo.png
rename to common/test/test_sites/test_site/images/header-logo.png
diff --git a/common/test/test_microsites/test_microsite/images/login-and-register-banner.png b/common/test/test_sites/test_site/images/login-and-register-banner.png
similarity index 100%
rename from common/test/test_microsites/test_microsite/images/login-and-register-banner.png
rename to common/test/test_sites/test_site/images/login-and-register-banner.png
diff --git a/common/test/test_microsites/test_microsite/templates/courseware/syllabus.html b/common/test/test_sites/test_site/templates/courseware/syllabus.html
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/courseware/syllabus.html
rename to common/test/test_sites/test_site/templates/courseware/syllabus.html
diff --git a/common/test/test_microsites/test_microsite/templates/courseware/tabs.html b/common/test/test_sites/test_site/templates/courseware/tabs.html
similarity index 95%
rename from common/test/test_microsites/test_microsite/templates/courseware/tabs.html
rename to common/test/test_sites/test_site/templates/courseware/tabs.html
index 2d70a465d8..2c0a2d27de 100644
--- a/common/test/test_microsites/test_microsite/templates/courseware/tabs.html
+++ b/common/test/test_sites/test_site/templates/courseware/tabs.html
@@ -19,7 +19,7 @@ def url_class(is_active):
%>
- Test Microsite Tab: ${_(tab.name) | h}
+ Test Site Tab: ${_(tab.name) | h}
% if tab_is_active:
, current location
%endif
diff --git a/common/test/test_microsites/test_microsite/templates/courseware/test_absolute_path.html b/common/test/test_sites/test_site/templates/courseware/test_absolute_path.html
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/courseware/test_absolute_path.html
rename to common/test/test_sites/test_site/templates/courseware/test_absolute_path.html
diff --git a/common/test/test_microsites/test_microsite/templates/courseware/test_relative_path.html b/common/test/test_sites/test_site/templates/courseware/test_relative_path.html
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/courseware/test_relative_path.html
rename to common/test/test_sites/test_site/templates/courseware/test_relative_path.html
diff --git a/common/test/test_microsites/test_microsite/templates/emails/activation_email.txt b/common/test/test_sites/test_site/templates/emails/activation_email.txt
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/emails/activation_email.txt
rename to common/test/test_sites/test_site/templates/emails/activation_email.txt
diff --git a/common/test/test_microsites/test_microsite/templates/emails/activation_email_subject.txt b/common/test/test_sites/test_site/templates/emails/activation_email_subject.txt
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/emails/activation_email_subject.txt
rename to common/test/test_sites/test_site/templates/emails/activation_email_subject.txt
diff --git a/common/test/test_microsites/test_microsite/templates/emails/confirm_email_change.txt b/common/test/test_sites/test_site/templates/emails/confirm_email_change.txt
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/emails/confirm_email_change.txt
rename to common/test/test_sites/test_site/templates/emails/confirm_email_change.txt
diff --git a/common/test/test_microsites/test_microsite/templates/emails/email_change.txt b/common/test/test_sites/test_site/templates/emails/email_change.txt
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/emails/email_change.txt
rename to common/test/test_sites/test_site/templates/emails/email_change.txt
diff --git a/common/test/test_microsites/test_microsite/templates/emails/email_change_subject.txt b/common/test/test_sites/test_site/templates/emails/email_change_subject.txt
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/emails/email_change_subject.txt
rename to common/test/test_sites/test_site/templates/emails/email_change_subject.txt
diff --git a/common/test/test_microsites/test_microsite/templates/emails/enroll_email_allowedmessage.txt b/common/test/test_sites/test_site/templates/emails/enroll_email_allowedmessage.txt
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/emails/enroll_email_allowedmessage.txt
rename to common/test/test_sites/test_site/templates/emails/enroll_email_allowedmessage.txt
diff --git a/common/test/test_microsites/test_microsite/templates/emails/enroll_email_allowedsubject.txt b/common/test/test_sites/test_site/templates/emails/enroll_email_allowedsubject.txt
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/emails/enroll_email_allowedsubject.txt
rename to common/test/test_sites/test_site/templates/emails/enroll_email_allowedsubject.txt
diff --git a/common/test/test_microsites/test_microsite/templates/emails/enroll_email_enrolledmessage.txt b/common/test/test_sites/test_site/templates/emails/enroll_email_enrolledmessage.txt
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/emails/enroll_email_enrolledmessage.txt
rename to common/test/test_sites/test_site/templates/emails/enroll_email_enrolledmessage.txt
diff --git a/common/test/test_microsites/test_microsite/templates/emails/enroll_email_enrolledsubject.txt b/common/test/test_sites/test_site/templates/emails/enroll_email_enrolledsubject.txt
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/emails/enroll_email_enrolledsubject.txt
rename to common/test/test_sites/test_site/templates/emails/enroll_email_enrolledsubject.txt
diff --git a/common/test/test_microsites/test_microsite/templates/emails/unenroll_email_allowedmessage.txt b/common/test/test_sites/test_site/templates/emails/unenroll_email_allowedmessage.txt
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/emails/unenroll_email_allowedmessage.txt
rename to common/test/test_sites/test_site/templates/emails/unenroll_email_allowedmessage.txt
diff --git a/common/test/test_microsites/test_microsite/templates/emails/unenroll_email_enrolledmessage.txt b/common/test/test_sites/test_site/templates/emails/unenroll_email_enrolledmessage.txt
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/emails/unenroll_email_enrolledmessage.txt
rename to common/test/test_sites/test_site/templates/emails/unenroll_email_enrolledmessage.txt
diff --git a/common/test/test_microsites/test_microsite/templates/emails/unenroll_email_subject.txt b/common/test/test_sites/test_site/templates/emails/unenroll_email_subject.txt
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/emails/unenroll_email_subject.txt
rename to common/test/test_sites/test_site/templates/emails/unenroll_email_subject.txt
diff --git a/common/test/test_microsites/test_microsite/templates/footer.html b/common/test/test_sites/test_site/templates/footer.html
similarity index 87%
rename from common/test/test_microsites/test_microsite/templates/footer.html
rename to common/test/test_sites/test_site/templates/footer.html
index a7044c0e35..6cf8edfcb4 100644
--- a/common/test/test_microsites/test_microsite/templates/footer.html
+++ b/common/test/test_sites/test_site/templates/footer.html
@@ -10,7 +10,7 @@ from django.utils.translation import ugettext as _
-
This is a Test Microsite footer
+
This is a Test Site footer
diff --git a/common/test/test_microsites/test_microsite/templates/head-extra.html b/common/test/test_sites/test_site/templates/head-extra.html
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/head-extra.html
rename to common/test/test_sites/test_site/templates/head-extra.html
diff --git a/common/test/test_microsites/test_microsite/templates/login-sidebar.html b/common/test/test_sites/test_site/templates/login-sidebar.html
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/login-sidebar.html
rename to common/test/test_sites/test_site/templates/login-sidebar.html
diff --git a/common/test/test_microsites/test_microsite/templates/register-sidebar.html b/common/test/test_sites/test_site/templates/register-sidebar.html
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/register-sidebar.html
rename to common/test/test_sites/test_site/templates/register-sidebar.html
diff --git a/common/test/test_microsites/test_microsite/templates/static_templates/about.html b/common/test/test_sites/test_site/templates/static_templates/about.html
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/static_templates/about.html
rename to common/test/test_sites/test_site/templates/static_templates/about.html
diff --git a/common/test/test_microsites/test_microsite/templates/static_templates/contact.html b/common/test/test_sites/test_site/templates/static_templates/contact.html
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/static_templates/contact.html
rename to common/test/test_sites/test_site/templates/static_templates/contact.html
diff --git a/common/test/test_sites/test_site/templates/static_templates/copyright.html b/common/test/test_sites/test_site/templates/static_templates/copyright.html
new file mode 100755
index 0000000000..6f68955d62
--- /dev/null
+++ b/common/test/test_sites/test_site/templates/static_templates/copyright.html
@@ -0,0 +1 @@
+This is a copyright page for an Open edX site.
diff --git a/common/test/test_microsites/test_microsite/templates/static_templates/faq.html b/common/test/test_sites/test_site/templates/static_templates/faq.html
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/static_templates/faq.html
rename to common/test/test_sites/test_site/templates/static_templates/faq.html
diff --git a/common/test/test_microsites/test_microsite/templates/static_templates/tos.html b/common/test/test_sites/test_site/templates/static_templates/tos.html
similarity index 100%
rename from common/test/test_microsites/test_microsite/templates/static_templates/tos.html
rename to common/test/test_sites/test_site/templates/static_templates/tos.html
diff --git a/lms/djangoapps/branding/__init__.py b/lms/djangoapps/branding/__init__.py
index d14489d322..22a16cb7ae 100644
--- a/lms/djangoapps/branding/__init__.py
+++ b/lms/djangoapps/branding/__init__.py
@@ -12,9 +12,8 @@ from xmodule.course_module import CourseDescriptor
from django.conf import settings
from opaque_keys.edx.locations import SlashSeparatedCourseKey
-from microsite_configuration import microsite
-from django.contrib.staticfiles.storage import staticfiles_storage
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
def get_visible_courses(org=None, filter_=None):
@@ -28,33 +27,32 @@ def get_visible_courses(org=None, filter_=None):
filter_ (dict): Optional parameter that allows custom filtering by
fields on the course.
"""
- microsite_org = microsite.get_value('course_org_filter')
+ current_site_org = configuration_helpers.get_value('course_org_filter')
- if org and microsite_org:
- # When called in the context of a microsite, return an empty result if the org
- # passed by the caller does not match the designated microsite org.
+ if org and current_site_org:
+ # Return an empty result if the org passed by the caller does not match the designated site org.
courses = CourseOverview.get_all_courses(
org=org,
filter_=filter_,
- ) if org == microsite_org else []
+ ) if org == current_site_org else []
else:
- # We only make it to this point if one of org or microsite_org is defined.
- # If both org and microsite_org were defined, the code would have fallen into the
+ # We only make it to this point if one of org or current_site_org is defined.
+ # If both org and current_site_org were defined, the code would have fallen into the
# first branch of the conditional above, wherein an equality check is performed.
- target_org = org or microsite_org
+ target_org = org or current_site_org
courses = CourseOverview.get_all_courses(org=target_org, filter_=filter_)
courses = sorted(courses, key=lambda course: course.number)
- # When called in the context of a microsite, filtering can stop here.
- if microsite_org:
+ # Filtering can stop here.
+ if current_site_org:
return courses
# See if we have filtered course listings in this domain
filtered_visible_ids = None
- # this is legacy format which is outside of the microsite feature -- also handle dev case, which should not filter
- subdomain = microsite.get_value('subdomain', 'default')
+ # this is legacy format, which also handle dev case, which should not filter
+ subdomain = configuration_helpers.get_value('subdomain', 'default')
if hasattr(settings, 'COURSE_LISTINGS') and subdomain in settings.COURSE_LISTINGS and not settings.DEBUG:
filtered_visible_ids = frozenset(
[SlashSeparatedCourseKey.from_deprecated_string(c) for c in settings.COURSE_LISTINGS[subdomain]]
@@ -63,9 +61,9 @@ def get_visible_courses(org=None, filter_=None):
if filtered_visible_ids:
return [course for course in courses if course.id in filtered_visible_ids]
else:
- # Filter out any courses belonging to a microsite, to avoid leaking these.
- microsite_orgs = microsite.get_all_orgs()
- return [course for course in courses if course.location.org not in microsite_orgs]
+ # Filter out any courses based on current org, to avoid leaking these.
+ orgs = configuration_helpers.get_all_orgs()
+ return [course for course in courses if course.location.org not in orgs]
def get_university_for_request():
@@ -73,4 +71,4 @@ def get_university_for_request():
Return the university name specified for the domain, or None
if no university was specified
"""
- return microsite.get_value('university')
+ return configuration_helpers.get_value('university')
diff --git a/lms/djangoapps/branding/api.py b/lms/djangoapps/branding/api.py
index 857706a863..582a902f05 100644
--- a/lms/djangoapps/branding/api.py
+++ b/lms/djangoapps/branding/api.py
@@ -19,9 +19,9 @@ from django.conf import settings
from django.utils.translation import ugettext as _
from django.contrib.staticfiles.storage import staticfiles_storage
-from microsite_configuration import microsite
from edxmako.shortcuts import marketing_link
from branding.models import BrandingApiConfig
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger("edx.footer")
@@ -117,7 +117,7 @@ def _footer_copyright():
u"\u00A9 {org_name}. All rights reserved except where noted. "
u"EdX, Open edX and the edX and Open EdX logos are registered trademarks "
u"or trademarks of edX Inc."
- ).format(org_name=microsite.get_value('PLATFORM_NAME', settings.PLATFORM_NAME))
+ ).format(org_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME))
def _footer_openedx_link():
@@ -145,7 +145,7 @@ def _footer_social_links():
Returns: list
"""
- platform_name = microsite.get_value('platform_name', settings.PLATFORM_NAME)
+ platform_name = configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME)
links = []
for social_name in settings.SOCIAL_MEDIA_FOOTER_NAMES:
@@ -222,7 +222,7 @@ def _footer_mobile_links(is_secure):
Returns: list
"""
- platform_name = microsite.get_value('platform_name', settings.PLATFORM_NAME)
+ platform_name = configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME)
mobile_links = []
if settings.FEATURES.get('ENABLE_FOOTER_MOBILE_APP_LINKS'):
@@ -256,8 +256,8 @@ def _footer_logo_img(is_secure):
Returns:
Absolute url to logo
"""
- logo_name = microsite.get_value('FOOTER_ORGANIZATION_IMAGE', settings.FOOTER_ORGANIZATION_IMAGE)
- # `logo_name` is looked up from the microsite configuration,
+ logo_name = configuration_helpers.get_value('FOOTER_ORGANIZATION_IMAGE', settings.FOOTER_ORGANIZATION_IMAGE)
+ # `logo_name` is looked up from the configuration,
# which falls back on the Django settings, which loads it from
# `lms.env.json`, which is created and managed by Ansible. Because of
# this runaround, we lose a lot of the flexibility that Django's
@@ -298,7 +298,7 @@ def _absolute_url(is_secure, url_path):
unicode
"""
- site_name = microsite.get_value('SITE_NAME', settings.SITE_NAME)
+ site_name = configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME)
parts = ("https" if is_secure else "http", site_name, url_path, '', '', '')
return urlparse.urlunparse(parts)
@@ -327,14 +327,14 @@ def _absolute_url_staticfile(is_secure, name):
return _absolute_url(is_secure, url_path)
-def get_microsite_url(name):
+def get_configuration_url(name):
"""
- Look up and return the value for given url name in microsite configuration.
- URLs are saved in "urls" dictionary inside Microsite Configuration.
+ Look up and return the value for given url name in configuration.
+ URLs are saved in "urls" dictionary inside configuration.
- Return 'EMPTY_URL' if given url name is not defined in microsite configuration urls.
+ Return 'EMPTY_URL' if given url name is not defined in configuration urls.
"""
- urls = microsite.get_value("urls", default={})
+ urls = configuration_helpers.get_value("urls", default={})
return urls.get(name) or EMPTY_URL
@@ -342,15 +342,15 @@ def get_url(name):
"""
Lookup and return page url, lookup is performed in the following order
- 1. get microsite url, If microsite URL override exists, return it
+ 1. get url, If configuration URL override exists, return it
2. Otherwise return the marketing URL.
:return: string containing page url.
"""
- # If a microsite URL override exists, return it. Otherwise return the marketing URL.
- microsite_url = get_microsite_url(name)
- if microsite_url != EMPTY_URL:
- return microsite_url
+ # If a configuration URL override exists, return it. Otherwise return the marketing URL.
+ configuration_url = get_configuration_url(name)
+ if configuration_url != EMPTY_URL:
+ return configuration_url
# get marketing link, if marketing is disabled then platform url will be used instead.
url = marketing_link(name)
@@ -360,7 +360,7 @@ def get_url(name):
def get_base_url(is_secure):
"""
- Return Base URL for site/microsite.
+ Return Base URL for site.
Arguments:
is_secure (bool): If true, use HTTPS as the protocol.
"""
@@ -374,9 +374,9 @@ def get_logo_url(is_secure=True):
is_secure (bool): If true, use HTTPS as the protocol.
"""
- # if the MicrositeConfiguration has a value for the logo_image_url
+ # if the configuration has an overide value for the logo_image_url
# let's use that
- image_url = microsite.get_value('logo_image_url')
+ image_url = configuration_helpers.get_value('logo_image_url')
if image_url:
return _absolute_url_staticfile(
is_secure=is_secure,
@@ -384,7 +384,7 @@ def get_logo_url(is_secure=True):
)
# otherwise, use the legacy means to configure this
- university = microsite.get_value('university')
+ university = configuration_helpers.get_value('university')
if university:
return staticfiles_storage.url('images/{uni}-on-edx-logo.png'.format(uni=university))
diff --git a/lms/djangoapps/branding/views.py b/lms/djangoapps/branding/views.py
index e858aa3e61..b73b2f8b5d 100644
--- a/lms/djangoapps/branding/views.py
+++ b/lms/djangoapps/branding/views.py
@@ -16,26 +16,25 @@ from edxmako.shortcuts import render_to_response
import student.views
from student.models import CourseEnrollment
import courseware.views.views
-from microsite_configuration import microsite
from edxmako.shortcuts import marketing_link
from util.cache import cache_if_anonymous
from util.json_request import JsonResponse
import branding.api as branding_api
-
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger(__name__)
def get_course_enrollments(user):
"""
- Returns the course enrollments for the passed in user within the context of a microsite, that
+ Returns the course enrollments for the passed in user within the context of current org, that
is filtered by course_org_filter
"""
enrollments = CourseEnrollment.enrollments_for_user(user)
- microsite_org = microsite.get_value('course_org_filter')
- if microsite_org:
+ course_org = configuration_helpers.get_value('course_org_filter')
+ if course_org:
site_enrollments = [
- enrollment for enrollment in enrollments if enrollment.course_id.org == microsite_org
+ enrollment for enrollment in enrollments if enrollment.course_id.org == course_org
]
else:
site_enrollments = [
@@ -52,11 +51,11 @@ def index(request):
'''
if request.user.is_authenticated():
- # For microsites, only redirect to dashboard if user has
+ # Only redirect to dashboard if user has
# courses in his/her dashboard. Otherwise UX is a bit cryptic.
# In this case, we want to have the user stay on a course catalog
# page to make it easier to browse for courses (and register)
- if microsite.get_value(
+ if configuration_helpers.get_value(
'ALWAYS_REDIRECT_HOMEPAGE_TO_DASHBOARD_FOR_AUTHENTICATED_USER',
settings.FEATURES.get('ALWAYS_REDIRECT_HOMEPAGE_TO_DASHBOARD_FOR_AUTHENTICATED_USER', True)):
return redirect(reverse('dashboard'))
@@ -71,7 +70,7 @@ def index(request):
request.GET = req_new
return ssl_login(request)
- enable_mktg_site = microsite.get_value(
+ enable_mktg_site = configuration_helpers.get_value(
'ENABLE_MKTG_SITE',
settings.FEATURES.get('ENABLE_MKTG_SITE', False)
)
@@ -82,7 +81,7 @@ def index(request):
domain = request.META.get('HTTP_HOST')
# keep specialized logic for Edge until we can migrate over Edge to fully use
- # microsite definitions
+ # configuration.
if domain and 'edge.edx.org' in domain:
return redirect(reverse("signin_user"))
@@ -99,7 +98,7 @@ def courses(request):
to that. Otherwise, if subdomain branding is on, this is the university
profile page. Otherwise, it's the edX courseware.views.views.courses page
"""
- enable_mktg_site = microsite.get_value(
+ enable_mktg_site = configuration_helpers.get_value(
'ENABLE_MKTG_SITE',
settings.FEATURES.get('ENABLE_MKTG_SITE', False)
)
diff --git a/lms/djangoapps/bulk_email/tasks.py b/lms/djangoapps/bulk_email/tasks.py
index 86b3978078..ac5475d213 100644
--- a/lms/djangoapps/bulk_email/tasks.py
+++ b/lms/djangoapps/bulk_email/tasks.py
@@ -51,7 +51,7 @@ from instructor_task.subtasks import (
)
from util.query import use_read_replica_if_available
from util.date_utils import get_default_time_display
-from openedx.core.djangoapps.theming import helpers as theming_helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger('edx.celery.task')
@@ -116,7 +116,7 @@ def _get_course_email_context(course):
'course_end_date': course_end_date,
'account_settings_url': 'https://{}{}'.format(settings.SITE_NAME, reverse('account_settings')),
'email_settings_url': 'https://{}{}'.format(settings.SITE_NAME, reverse('dashboard')),
- 'platform_name': theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ 'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
}
return email_context
@@ -388,7 +388,7 @@ def _get_source_address(course_id, course_title, truncate=True):
return from_addr_format.format(
course_title=course_title_no_quotes,
course_name=course_name,
- from_email=theming_helpers.get_value(
+ from_email=configuration_helpers.get_value(
'email_from_address',
settings.BULK_EMAIL_DEFAULT_FROM_EMAIL
)
diff --git a/lms/djangoapps/certificates/api.py b/lms/djangoapps/certificates/api.py
index 56b71d5ce8..131e0ae2e3 100644
--- a/lms/djangoapps/certificates/api.py
+++ b/lms/djangoapps/certificates/api.py
@@ -568,7 +568,7 @@ def get_asset_url_by_slug(asset_slug):
def get_certificate_header_context(is_secure=True):
"""
Return data to be used in Certificate Header,
- data returned should be customized according to the microsite settings
+ data returned should be customized according to the site configuration.
"""
data = dict(
logo_src=branding_api.get_logo_url(is_secure),
@@ -581,7 +581,7 @@ def get_certificate_header_context(is_secure=True):
def get_certificate_footer_context():
"""
Return data to be used in Certificate Footer,
- data returned should be customized according to the microsite settings
+ data returned should be customized according to the site configuration.
"""
data = dict()
diff --git a/lms/djangoapps/certificates/tests/factories.py b/lms/djangoapps/certificates/tests/factories.py
index 7b88cfe0e2..d0297ddff3 100644
--- a/lms/djangoapps/certificates/tests/factories.py
+++ b/lms/djangoapps/certificates/tests/factories.py
@@ -74,10 +74,10 @@ class CertificateHtmlViewConfigurationFactory(DjangoModelFactory):
"certificate_type": "XSeries"
},
"microsites": {
- "testmicrosite": {
- "company_about_url": "http://www.testmicrosite.org/about-us",
- "company_privacy_url": "http://www.testmicrosite.org/edx-privacy-policy",
- "company_tos_url": "http://www.testmicrosite.org/edx-terms-service"
+ "test-site": {
+ "company_about_url": "http://www.test-site.org/about-us",
+ "company_privacy_url": "http://www.test-site.org/edx-privacy-policy",
+ "company_tos_url": "http://www.test-site.org/edx-terms-service"
}
}
}"""
diff --git a/lms/djangoapps/certificates/tests/test_api.py b/lms/djangoapps/certificates/tests/test_api.py
index cbbd58ad43..dcf95c4fb4 100644
--- a/lms/djangoapps/certificates/tests/test_api.py
+++ b/lms/djangoapps/certificates/tests/test_api.py
@@ -659,7 +659,7 @@ class CertificatesBrandingTest(TestCase):
def setUp(self):
super(CertificatesBrandingTest, self).setUp()
- @set_microsite(settings.MICROSITE_CONFIGURATION['test_microsite']['domain_prefix'])
+ @set_microsite(settings.MICROSITE_CONFIGURATION['test_site']['domain_prefix'])
def test_certificate_header_data(self):
"""
Test that get_certificate_header_context from certificates api
@@ -675,16 +675,16 @@ class CertificatesBrandingTest(TestCase):
['logo_src', 'logo_url']
)
self.assertIn(
- settings.MICROSITE_CONFIGURATION['test_microsite']['logo_image_url'],
+ settings.MICROSITE_CONFIGURATION['test_site']['logo_image_url'],
data['logo_src']
)
self.assertIn(
- settings.MICROSITE_CONFIGURATION['test_microsite']['SITE_NAME'],
+ settings.MICROSITE_CONFIGURATION['test_site']['SITE_NAME'],
data['logo_url']
)
- @set_microsite(settings.MICROSITE_CONFIGURATION['test_microsite']['domain_prefix'])
+ @set_microsite(settings.MICROSITE_CONFIGURATION['test_site']['domain_prefix'])
def test_certificate_footer_data(self):
"""
Test that get_certificate_footer_context from certificates api returns
@@ -700,21 +700,21 @@ class CertificatesBrandingTest(TestCase):
['company_about_url', 'company_privacy_url', 'company_tos_url']
)
- # ABOUT is present in MICROSITE_CONFIGURATION['test_microsite']["urls"] so web certificate will use that url
+ # ABOUT is present in MICROSITE_CONFIGURATION['test_site']["urls"] so web certificate will use that url
self.assertIn(
- settings.MICROSITE_CONFIGURATION['test_microsite']["urls"]['ABOUT'],
+ settings.MICROSITE_CONFIGURATION['test_site']["urls"]['ABOUT'],
data['company_about_url']
)
- # PRIVACY is present in MICROSITE_CONFIGURATION['test_microsite']["urls"] so web certificate will use that url
+ # PRIVACY is present in MICROSITE_CONFIGURATION['test_site']["urls"] so web certificate will use that url
self.assertIn(
- settings.MICROSITE_CONFIGURATION['test_microsite']["urls"]['PRIVACY'],
+ settings.MICROSITE_CONFIGURATION['test_site']["urls"]['PRIVACY'],
data['company_privacy_url']
)
- # TOS_AND_HONOR is present in MICROSITE_CONFIGURATION['test_microsite']["urls"],
+ # TOS_AND_HONOR is present in MICROSITE_CONFIGURATION['test_site']["urls"],
# so web certificate will use that url
self.assertIn(
- settings.MICROSITE_CONFIGURATION['test_microsite']["urls"]['TOS_AND_HONOR'],
+ settings.MICROSITE_CONFIGURATION['test_site']["urls"]['TOS_AND_HONOR'],
data['company_tos_url']
)
diff --git a/lms/djangoapps/certificates/tests/test_views.py b/lms/djangoapps/certificates/tests/test_views.py
index 85dc913d31..9966c69018 100644
--- a/lms/djangoapps/certificates/tests/test_views.py
+++ b/lms/djangoapps/certificates/tests/test_views.py
@@ -271,7 +271,7 @@ class MicrositeCertificatesViewsTests(ModuleStoreTestCase):
"logo_url": "http://www.edx.org"
},
"microsites": {
- "testmicrosite": {
+ "test-site": {
"accomplishment_class_append": "accomplishment-certificate",
"platform_name": "platform_microsite",
"company_about_url": "http://www.microsite.org/about-us",
@@ -301,7 +301,7 @@ class MicrositeCertificatesViewsTests(ModuleStoreTestCase):
self.assertIn('platform_microsite', response.content)
# logo url is taken from microsite configuration setting
- self.assertIn('http://test_microsite.localhost', response.content)
+ self.assertIn('http://test_site.localhost', response.content)
self.assertIn('This is special microsite aware company_about_description content', response.content)
self.assertIn('Microsite title', response.content)
diff --git a/lms/djangoapps/certificates/tests/test_webview_views.py b/lms/djangoapps/certificates/tests/test_webview_views.py
index 78f3b82a86..de9e061872 100644
--- a/lms/djangoapps/certificates/tests/test_webview_views.py
+++ b/lms/djangoapps/certificates/tests/test_webview_views.py
@@ -211,9 +211,9 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
self.assertEqual(response.status_code, 200)
# the linkedIn share URL with appropriate parameters should be present
params = OrderedDict([
- ('_ed', settings.MICROSITE_CONFIGURATION['test_microsite']['LINKEDIN_COMPANY_ID'],),
+ ('_ed', settings.MICROSITE_CONFIGURATION['test_site']['LINKEDIN_COMPANY_ID'],),
('pfCertificationName', '{platform_name} Honor Code Certificate for {course_name}'.format(
- platform_name=settings.MICROSITE_CONFIGURATION['test_microsite']['platform_name'],
+ platform_name=settings.MICROSITE_CONFIGURATION['test_site']['platform_name'],
course_name=self.course.display_name,
),),
('pfCertificationUrl', 'http://' + settings.MICROSITE_TEST_HOSTNAME + test_url,),
@@ -235,7 +235,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
response = self.client.get(test_url, HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
self.assertEqual(response.status_code, 200)
self.assertIn("Post on Facebook", response.content)
- self.assertIn(settings.MICROSITE_CONFIGURATION['test_microsite']['FACEBOOK_APP_ID'], response.content)
+ self.assertIn(settings.MICROSITE_CONFIGURATION['test_site']['FACEBOOK_APP_ID'], response.content)
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
@ddt.data(
@@ -258,8 +258,8 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
CERTIFICATE_LINKEDIN=linkedin_sharing,
)
with patch("django.conf.settings.MICROSITE_CONFIGURATION", {
- "test_microsite": dict(
- settings.MICROSITE_CONFIGURATION['test_microsite'],
+ "test_site": dict(
+ settings.MICROSITE_CONFIGURATION['test_site'],
SOCIAL_SHARING_SETTINGS=social_sharing_settings,
)
}):
@@ -276,14 +276,14 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
"""
self._add_course_certificates(count=1, signatory_count=1, is_active=True)
test_url = get_certificate_url(course_id=self.cert.course_id, uuid=self.cert.verify_uuid)
- facebook_text = "Facebook text on Test Microsite"
+ facebook_text = "Facebook text on Test Site"
social_sharing_settings = dict(
CERTIFICATE_FACEBOOK=True,
CERTIFICATE_FACEBOOK_TEXT=facebook_text,
)
with patch("django.conf.settings.MICROSITE_CONFIGURATION", {
- "test_microsite": dict(
- settings.MICROSITE_CONFIGURATION['test_microsite'],
+ "test_site": dict(
+ settings.MICROSITE_CONFIGURATION['test_site'],
SOCIAL_SHARING_SETTINGS=social_sharing_settings,
)
}):
@@ -297,14 +297,14 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
"""
self._add_course_certificates(count=1, signatory_count=1, is_active=True)
test_url = get_certificate_url(course_id=self.cert.course_id, uuid=self.cert.verify_uuid)
- twitter_text = "Twitter text on Test Microsite"
+ twitter_text = "Twitter text on Test Site"
social_sharing_settings = dict(
CERTIFICATE_TWITTER=True,
CERTIFICATE_TWITTER_TEXT=twitter_text,
)
with patch("django.conf.settings.MICROSITE_CONFIGURATION", {
- "test_microsite": dict(
- settings.MICROSITE_CONFIGURATION['test_microsite'],
+ "test_site": dict(
+ settings.MICROSITE_CONFIGURATION['test_site'],
SOCIAL_SHARING_SETTINGS=social_sharing_settings,
)
}):
@@ -371,8 +371,8 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
"CERTIFICATE_FACEBOOK": True,
})
@patch.dict("django.conf.settings.MICROSITE_CONFIGURATION", {
- "test_microsite": dict(
- settings.MICROSITE_CONFIGURATION['test_microsite'],
+ "test_site": dict(
+ settings.MICROSITE_CONFIGURATION['test_site'],
urls=dict(
ABOUT=None,
PRIVACY=None,
@@ -430,7 +430,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
)
# Test an item from html cert configuration
self.assertIn(
- '',
+ ' ',
response.content
)
# Test an item from course info
@@ -469,7 +469,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
)
# Test item from microsite info
self.assertIn(
- "http://www.testmicrosite.org/about-us",
+ "http://www.test-site.org/about-us",
response.content
)
# Test course overrides
@@ -1025,33 +1025,33 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
course_id=unicode(self.course.id)
)
response = self.client.get(test_url, HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
- # logo_image_url Tis present in MICROSITE_CONFIGURATION['test_microsite']["urls"],
+ # logo_image_url Tis present in MICROSITE_CONFIGURATION['test_site']["urls"],
# so web certificate will use that.
self.assertContains(
response,
- settings.MICROSITE_CONFIGURATION['test_microsite']['logo_image_url'],
+ settings.MICROSITE_CONFIGURATION['test_site']['logo_image_url'],
)
- # ABOUT is present in MICROSITE_CONFIGURATION['test_microsite']["urls"] so web certificate will use that url.
+ # ABOUT is present in MICROSITE_CONFIGURATION['test_site']["urls"] so web certificate will use that url.
self.assertContains(
response,
- settings.MICROSITE_CONFIGURATION['test_microsite']["urls"]['ABOUT'],
+ settings.MICROSITE_CONFIGURATION['test_site']["urls"]['ABOUT'],
)
- # PRIVACY is present in MICROSITE_CONFIGURATION['test_microsite']["urls"] so web certificate will use that url.
+ # PRIVACY is present in MICROSITE_CONFIGURATION['test_site']["urls"] so web certificate will use that url.
self.assertContains(
response,
- settings.MICROSITE_CONFIGURATION['test_microsite']["urls"]['PRIVACY'],
+ settings.MICROSITE_CONFIGURATION['test_site']["urls"]['PRIVACY'],
)
- # TOS_AND_HONOR is present in MICROSITE_CONFIGURATION['test_microsite']["urls"],
+ # TOS_AND_HONOR is present in MICROSITE_CONFIGURATION['test_site']["urls"],
# so web certificate will use that url.
self.assertContains(
response,
- settings.MICROSITE_CONFIGURATION['test_microsite']["urls"]['TOS_AND_HONOR'],
+ settings.MICROSITE_CONFIGURATION['test_site']["urls"]['TOS_AND_HONOR'],
)
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
@patch.dict("django.conf.settings.MICROSITE_CONFIGURATION", {
- "test_microsite": dict(
- settings.MICROSITE_CONFIGURATION['test_microsite'],
+ "test_site": dict(
+ settings.MICROSITE_CONFIGURATION['test_site'],
urls=dict(
ABOUT=None,
PRIVACY=None,
@@ -1073,29 +1073,29 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
course_id=unicode(self.course.id)
)
response = self.client.get(test_url, HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
- # ABOUT is not present in MICROSITE_CONFIGURATION['test_microsite']["urls"],
+ # ABOUT is not present in MICROSITE_CONFIGURATION['test_site']["urls"],
# so web certificate will use MKTG_URL_LINK_MAP['ABOUT'] url.
self.assertContains(
response,
settings.MKTG_URL_LINK_MAP['ABOUT'],
)
- # PRIVACY is not present in MICROSITE_CONFIGURATION['test_microsite']["urls"],
+ # PRIVACY is not present in MICROSITE_CONFIGURATION['test_site']["urls"],
# so web certificate will use MKTG_URL_LINK_MAP['PRIVACY'] url.
self.assertContains(
response,
settings.MKTG_URL_LINK_MAP['PRIVACY'],
)
- # TOS_AND_HONOR is not present in MICROSITE_CONFIGURATION['test_microsite']["urls"] or MKTG_URL_LINK_MAP,
+ # TOS_AND_HONOR is not present in MICROSITE_CONFIGURATION['test_site']["urls"] or MKTG_URL_LINK_MAP,
# so web certificate will use CertificateHtmlViewConfiguration url.
self.assertContains(
response,
- configuration['microsites']['testmicrosite']['company_tos_url'],
+ configuration['microsites']['test-site']['company_tos_url'],
)
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
@patch.dict("django.conf.settings.MICROSITE_CONFIGURATION", {
- "test_microsite": dict(
- settings.MICROSITE_CONFIGURATION['test_microsite'],
+ "test_site": dict(
+ settings.MICROSITE_CONFIGURATION['test_site'],
urls=dict(
ABOUT=None,
PRIVACY=None,
@@ -1125,23 +1125,23 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
)
response = self.client.get(test_url, HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
- # ABOUT is not present in MICROSITE_CONFIGURATION['test_microsite']["urls"] or MKTG_URL_LINK_MAP,
+ # ABOUT is not present in MICROSITE_CONFIGURATION['test_site']["urls"] or MKTG_URL_LINK_MAP,
# so web certificate will use CertificateHtmlViewConfiguration url.
self.assertContains(
response,
- configuration['microsites']['testmicrosite']['company_about_url'],
+ configuration['microsites']['test-site']['company_about_url'],
)
- # PRIVACY is not present in MICROSITE_CONFIGURATION['test_microsite']["urls"] or MKTG_URL_LINK_MAP,
+ # PRIVACY is not present in MICROSITE_CONFIGURATION['test_site']["urls"] or MKTG_URL_LINK_MAP,
# so web certificate will use CertificateHtmlViewConfiguration url.
self.assertContains(
response,
- configuration['microsites']['testmicrosite']['company_privacy_url'],
+ configuration['microsites']['test-site']['company_privacy_url'],
)
- # TOS_AND_HONOR is not present in MICROSITE_CONFIGURATION['test_microsite']["urls"] or MKTG_URL_LINK_MAP,
+ # TOS_AND_HONOR is not present in MICROSITE_CONFIGURATION['test_site']["urls"] or MKTG_URL_LINK_MAP,
# so web certificate will use CertificateHtmlViewConfiguration url.
self.assertContains(
response,
- configuration['microsites']['testmicrosite']['company_tos_url'],
+ configuration['microsites']['test-site']['company_tos_url'],
)
diff --git a/lms/djangoapps/certificates/views/webview.py b/lms/djangoapps/certificates/views/webview.py
index 381c2fa7ad..614df97320 100644
--- a/lms/djangoapps/certificates/views/webview.py
+++ b/lms/djangoapps/certificates/views/webview.py
@@ -20,10 +20,10 @@ from courseware.access import has_access
from edxmako.shortcuts import render_to_response
from edxmako.template import Template
from eventtracking import tracker
-from microsite_configuration import microsite
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from openedx.core.lib.courses import course_image_url
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from student.models import LinkedInAddToProfileConfiguration
from util import organizations_helpers as organization_api
from util.views import handle_500
@@ -45,7 +45,6 @@ from certificates.models import (
CertificateHtmlViewConfiguration,
CertificateSocialNetworks)
-
log = logging.getLogger(__name__)
@@ -250,9 +249,9 @@ def _update_social_context(request, context, course, user, user_certificate, pla
"""
Updates context dictionary with info required for social sharing.
"""
- share_settings = microsite.get_value("SOCIAL_SHARING_SETTINGS", settings.SOCIAL_SHARING_SETTINGS)
+ share_settings = configuration_helpers.get_value("SOCIAL_SHARING_SETTINGS", settings.SOCIAL_SHARING_SETTINGS)
context['facebook_share_enabled'] = share_settings.get('CERTIFICATE_FACEBOOK', False)
- context['facebook_app_id'] = microsite.get_value("FACEBOOK_APP_ID", settings.FACEBOOK_APP_ID)
+ context['facebook_app_id'] = configuration_helpers.get_value("FACEBOOK_APP_ID", settings.FACEBOOK_APP_ID)
context['facebook_share_text'] = share_settings.get(
'CERTIFICATE_FACEBOOK_TEXT',
_("I completed the {course_title} course on {platform_name}.").format(
@@ -420,14 +419,13 @@ def _render_certificate_template(request, context, course, user_certificate):
return render_to_response("certificates/valid.html", context)
-def _update_microsite_context(context, configuration):
+def _update_configuration_context(context, configuration):
"""
- Updates context with microsites data.
- Microsites will need to be able to override any hard coded
+ Site Configuration will need to be able to override any hard coded
content that was put into the context in the
_update_certificate_context() call above. For example the
'company_about_description' talks about edX, which we most likely
- do not want to keep in a microsite
+ do not want to keep in configurations.
So we need to re-apply any configuration/content that
we are sourcing from the database. This is somewhat duplicative of
the code at the beginning of this method, but we
@@ -435,10 +433,10 @@ def _update_microsite_context(context, configuration):
require that to be set up early on in the pipeline
"""
- microsite_config_key = microsite.get_value('domain_prefix')
- microsites_config = configuration.get("microsites", {})
- if microsite_config_key and microsites_config:
- context.update(microsites_config.get(microsite_config_key, {}))
+ config_key = configuration_helpers.get_value('domain_prefix')
+ config = configuration.get("microsites", {})
+ if config_key and config:
+ context.update(config.get(config_key, {}))
def _update_badge_context(context, course, user):
@@ -502,7 +500,7 @@ def render_html_view(request, user_id, course_id):
raise Http404
preview_mode = request.GET.get('preview', None)
- platform_name = microsite.get_value("platform_name", settings.PLATFORM_NAME)
+ platform_name = configuration_helpers.get_value("platform_name", settings.PLATFORM_NAME)
configuration = CertificateHtmlViewConfiguration.get_config()
# Create the initial view context, bootstrapping with Django settings and passed-in values
context = {}
@@ -578,8 +576,8 @@ def render_html_view(request, user_id, course_id):
# Append badge info
_update_badge_context(context, course, user)
- # Append microsite overrides
- _update_microsite_context(context, configuration)
+ # Append site configuration overrides
+ _update_configuration_context(context, configuration)
# Add certificate header/footer data to current context
context.update(get_certificate_header_context(is_secure=request.is_secure()))
diff --git a/lms/djangoapps/commerce/signals.py b/lms/djangoapps/commerce/signals.py
index f08c5facbe..033a744998 100644
--- a/lms/djangoapps/commerce/signals.py
+++ b/lms/djangoapps/commerce/signals.py
@@ -12,11 +12,11 @@ from django.utils.translation import ugettext as _
from edx_rest_api_client.exceptions import HttpClientError
import requests
-from microsite_configuration import microsite
from request_cache.middleware import RequestCache
from student.models import UNENROLL_DONE
from openedx.core.djangoapps.commerce.utils import ecommerce_api_client, is_commerce_service_configured
-from openedx.core.djangoapps.theming.helpers import get_value
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
+from openedx.core.djangoapps.theming import helpers as theming_helpers
log = logging.getLogger(__name__)
@@ -197,7 +197,9 @@ def generate_refund_notification_body(student, refund_ids): # pylint: disable=i
"To process this request, please visit the link(s) below."
).format(username=student.username, email=student.email)
- ecommerce_url_root = get_value('ECOMMERCE_PUBLIC_URL_ROOT', settings.ECOMMERCE_PUBLIC_URL_ROOT)
+ ecommerce_url_root = configuration_helpers.get_value(
+ 'ECOMMERCE_PUBLIC_URL_ROOT', settings.ECOMMERCE_PUBLIC_URL_ROOT,
+ )
refund_urls = [urljoin(ecommerce_url_root, '/dashboard/refunds/{}/'.format(refund_id))
for refund_id in refund_ids]
@@ -209,9 +211,9 @@ def send_refund_notification(course_enrollment, refund_ids):
tags = ['auto_refund']
- if microsite.is_request_in_microsite():
+ if theming_helpers.is_request_in_themed_site():
# this is not presently supported with the external service.
- raise NotImplementedError("Unable to send refund processing emails to microsite teams.")
+ raise NotImplementedError("Unable to send refund processing emails to support teams.")
student = course_enrollment.user
subject = _("[Refund] User-Requested Refund")
diff --git a/lms/djangoapps/commerce/tests/test_signals.py b/lms/djangoapps/commerce/tests/test_signals.py
index 9e37edbb66..81b3e68c26 100644
--- a/lms/djangoapps/commerce/tests/test_signals.py
+++ b/lms/djangoapps/commerce/tests/test_signals.py
@@ -198,11 +198,11 @@ class TestRefundSignal(TestCase):
self.assertTrue(mock_send_notification.called)
self.assertTrue(mock_log_warning.called)
- @mock.patch('commerce.signals.microsite.is_request_in_microsite', return_value=True)
- def test_notification_microsite(self, mock_is_request_in_microsite): # pylint: disable=unused-argument
+ @mock.patch('openedx.core.djangoapps.theming.helpers.is_request_in_themed_site', return_value=True)
+ def test_notification_themed_site(self, mock_is_request_in_themed_site): # pylint: disable=unused-argument
"""
Ensure the notification function raises an Exception if used in the
- context of microsites.
+ context of themed site.
"""
with self.assertRaises(NotImplementedError):
send_refund_notification(self.course_enrollment, [1, 2, 3])
diff --git a/lms/djangoapps/commerce/utils.py b/lms/djangoapps/commerce/utils.py
index daa75e5ad6..b36554400e 100644
--- a/lms/djangoapps/commerce/utils.py
+++ b/lms/djangoapps/commerce/utils.py
@@ -5,7 +5,7 @@ from urlparse import urljoin
from django.conf import settings
from commerce.models import CommerceConfiguration
-from openedx.core.djangoapps.theming import helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger(__name__)
@@ -61,7 +61,10 @@ class EcommerceService(object):
Example:
http://localhost:8002/basket/single_item/
"""
- ecommerce_url_root = helpers.get_value('ECOMMERCE_PUBLIC_URL_ROOT', settings.ECOMMERCE_PUBLIC_URL_ROOT)
+ ecommerce_url_root = configuration_helpers.get_value(
+ 'ECOMMERCE_PUBLIC_URL_ROOT',
+ settings.ECOMMERCE_PUBLIC_URL_ROOT,
+ )
return urljoin(ecommerce_url_root, self.config.single_course_checkout_page)
def checkout_page_url(self, sku):
diff --git a/lms/djangoapps/commerce/views.py b/lms/djangoapps/commerce/views.py
index f24df08ba8..bf342ac30d 100644
--- a/lms/djangoapps/commerce/views.py
+++ b/lms/djangoapps/commerce/views.py
@@ -9,10 +9,10 @@ from django.views.decorators.csrf import csrf_exempt
from commerce.models import CommerceConfiguration
from edxmako.shortcuts import render_to_response
-from microsite_configuration import microsite
from lms.djangoapps.verify_student.models import SoftwareSecurePhotoVerification
from openedx.core.djangoapps.theming.helpers import is_request_in_themed_site
from shoppingcart.processors.CyberSource2 import is_user_payment_error
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger(__name__)
@@ -21,14 +21,22 @@ log = logging.getLogger(__name__)
@csrf_exempt
def checkout_cancel(_request):
""" Checkout/payment cancellation view. """
- context = {'payment_support_email': microsite.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)}
+ context = {
+ 'payment_support_email': configuration_helpers.get_value(
+ 'payment_support_email', settings.PAYMENT_SUPPORT_EMAIL,
+ )
+ }
return render_to_response("commerce/checkout_cancel.html", context)
@csrf_exempt
def checkout_error(_request):
""" Checkout/payment error view. """
- context = {'payment_support_email': microsite.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)}
+ context = {
+ 'payment_support_email': configuration_helpers.get_value(
+ 'payment_support_email', settings.PAYMENT_SUPPORT_EMAIL,
+ )
+ }
return render_to_response("commerce/checkout_error.html", context)
@@ -39,7 +47,7 @@ def checkout_receipt(request):
page_title = _('Receipt')
is_payment_complete = True
- payment_support_email = microsite.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)
+ payment_support_email = configuration_helpers.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)
payment_support_link = ' {email} '.format(email=payment_support_email)
is_cybersource = all(k in request.POST for k in ('signed_field_names', 'decision', 'reason_code'))
@@ -77,7 +85,7 @@ def checkout_receipt(request):
context = {
'page_title': page_title,
'is_payment_complete': is_payment_complete,
- 'platform_name': microsite.get_value('platform_name', settings.PLATFORM_NAME),
+ 'platform_name': configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME),
'verified': SoftwareSecurePhotoVerification.verification_valid_or_pending(request.user).exists(),
'error_summary': error_summary,
'error_text': error_text,
diff --git a/lms/djangoapps/course_wiki/views.py b/lms/djangoapps/course_wiki/views.py
index c930ef8fd8..319c7e812a 100644
--- a/lms/djangoapps/course_wiki/views.py
+++ b/lms/djangoapps/course_wiki/views.py
@@ -15,7 +15,7 @@ from wiki.models import URLPath, Article
from courseware.courses import get_course_by_id
from course_wiki.utils import course_wiki_slug
from opaque_keys.edx.locations import SlashSeparatedCourseKey
-from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger(__name__)
@@ -112,8 +112,9 @@ def get_or_create_root():
pass
starting_content = "\n".join((
- _("Welcome to the {platform_name} Wiki").format(platform_name=get_themed_value('PLATFORM_NAME',
- settings.PLATFORM_NAME)),
+ _("Welcome to the {platform_name} Wiki").format(
+ platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ ),
"===",
_("Visit a course wiki to add an article."),
))
diff --git a/lms/djangoapps/courseware/courses.py b/lms/djangoapps/courseware/courses.py
index 1b63685156..e932089ef4 100644
--- a/lms/djangoapps/courseware/courses.py
+++ b/lms/djangoapps/courseware/courses.py
@@ -19,7 +19,6 @@ from xmodule.modulestore.exceptions import ItemNotFoundError
from static_replace import replace_static_urls
from xmodule.modulestore import ModuleStoreEnum
from xmodule.x_module import STUDENT_VIEW
-from microsite_configuration import microsite
from courseware.access import has_access
from courseware.date_summary import (
@@ -37,6 +36,7 @@ import branding
from opaque_keys.edx.keys import UsageKey
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger(__name__)
@@ -380,7 +380,7 @@ def get_courses(user, org=None, filter_=None):
"""
courses = branding.get_visible_courses(org=org, filter_=filter_)
- permission_name = microsite.get_value(
+ permission_name = configuration_helpers.get_value(
'COURSE_CATALOG_VISIBILITY_PERMISSION',
settings.COURSE_CATALOG_VISIBILITY_PERMISSION
)
@@ -394,7 +394,7 @@ def get_permission_for_course_about():
"""
Returns the CourseOverview object for the course after checking for access.
"""
- return microsite.get_value(
+ return configuration_helpers.get_value(
'COURSE_ABOUT_VISIBILITY_PERMISSION',
settings.COURSE_ABOUT_VISIBILITY_PERMISSION
)
diff --git a/lms/djangoapps/courseware/tests/test_courses.py b/lms/djangoapps/courseware/tests/test_courses.py
index a3cbf06be4..304d84390f 100644
--- a/lms/djangoapps/courseware/tests/test_courses.py
+++ b/lms/djangoapps/courseware/tests/test_courses.py
@@ -89,13 +89,13 @@ class CoursesTest(ModuleStoreTestCase):
"""
Verify that org filtering performs as expected, and that an empty result
is returned if the org passed by the caller does not match the designated
- microsite org.
+ org.
"""
primary = 'primary'
alternate = 'alternate'
def _fake_get_value(value, default=None):
- """Used to stub out microsite.get_value()."""
+ """Used to stub out site_configuration.helpers.get_value()."""
if value == 'course_org_filter':
return alternate
@@ -120,17 +120,20 @@ class CoursesTest(ModuleStoreTestCase):
all(course.org == primary_course.org for course in filtered_courses)
)
- with mock.patch('microsite_configuration.microsite.get_value', autospec=True) as mock_get_value:
+ with mock.patch(
+ 'openedx.core.djangoapps.site_configuration.helpers.get_value',
+ autospec=True,
+ ) as mock_get_value:
mock_get_value.side_effect = _fake_get_value
- # Request filtering for an org distinct from the designated microsite org.
+ # Request filtering for an org distinct from the designated org.
no_courses = get_courses(user, org=primary)
self.assertEqual(no_courses, [])
- # Request filtering for an org matching the designated microsite org.
- microsite_courses = get_courses(user, org=alternate)
+ # Request filtering for an org matching the designated org.
+ site_courses = get_courses(user, org=alternate)
self.assertTrue(
- all(course.org == alternate_course.org for course in microsite_courses)
+ all(course.org == alternate_course.org for course in site_courses)
)
def test_get_courses_with_filter(self):
diff --git a/lms/djangoapps/courseware/tests/test_microsites.py b/lms/djangoapps/courseware/tests/test_microsites.py
index b8c64bf8d2..6b226fb4cd 100644
--- a/lms/djangoapps/courseware/tests/test_microsites.py
+++ b/lms/djangoapps/courseware/tests/test_microsites.py
@@ -1,5 +1,5 @@
"""
-Tests related to the Microsites feature
+Tests related to the Site COnfiguration feature
"""
from django.conf import settings
from django.core.urlresolvers import reverse
@@ -15,19 +15,19 @@ from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
@attr('shard_1')
-class TestMicrosites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
+class TestSites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
"""
- This is testing of the Microsite feature
+ This is testing of the Site Configuration feature
"""
STUDENT_INFO = [('view@test.com', 'foo'), ('view2@test.com', 'foo')]
@classmethod
def setUpClass(cls):
- super(TestMicrosites, cls).setUpClass()
+ super(TestSites, cls).setUpClass()
cls.course = CourseFactory.create(
display_name='Robot_Super_Course',
- org='TestMicrositeX',
+ org='TestSiteX',
emit_signals=True,
)
cls.chapter0 = ItemFactory.create(parent_location=cls.course.location, display_name='Overview')
@@ -35,8 +35,8 @@ class TestMicrosites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
cls.section0 = ItemFactory.create(parent_location=cls.chapter0.location, display_name='Welcome')
cls.section9 = ItemFactory.create(parent_location=cls.chapter9.location, display_name='factory_section')
- cls.course_outside_microsite = CourseFactory.create(
- display_name='Robot_Course_Outside_Microsite',
+ cls.course_outside_site = CourseFactory.create(
+ display_name='Robot_Course_Outside_Site',
org='FooX',
emit_signals=True,
)
@@ -44,7 +44,7 @@ class TestMicrosites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
# have a course which explicitly sets visibility in catalog to False
cls.course_hidden_visibility = CourseFactory.create(
display_name='Hidden_course',
- org='TestMicrositeX',
+ org='TestSiteX',
catalog_visibility=CATALOG_VISIBILITY_NONE,
emit_signals=True,
)
@@ -52,14 +52,14 @@ class TestMicrosites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
# have a course which explicitly sets visibility in catalog and about to true
cls.course_with_visibility = CourseFactory.create(
display_name='visible_course',
- org='TestMicrositeX',
+ org='TestSiteX',
course="foo",
catalog_visibility=CATALOG_VISIBILITY_CATALOG_AND_ABOUT,
emit_signals=True,
)
def setUp(self):
- super(TestMicrosites, self).setUp()
+ super(TestSites, self).setUp()
def setup_users(self):
# Create student accounts and activate them.
@@ -70,22 +70,22 @@ class TestMicrosites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
self.activate_user(email)
@override_settings(SITE_NAME=settings.MICROSITE_TEST_HOSTNAME)
- def test_microsite_anonymous_homepage_content(self):
+ def test_site_anonymous_homepage_content(self):
"""
- Verify that the homepage, when accessed via a Microsite domain, returns
- HTML that reflects the Microsite branding elements
+ Verify that the homepage, when accessed via a Site domain, returns
+ HTML that reflects the Site branding elements
"""
resp = self.client.get('/', HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
self.assertEqual(resp.status_code, 200)
- # assert various branding definitions on this Microsite
- # as per the configuration and Microsite overrides
+ # assert various branding definitions on this Site
+ # as per the configuration and Site overrides
- self.assertContains(resp, 'This is a Test Microsite Overlay') # Overlay test message
- self.assertContains(resp, 'test_microsite/images/header-logo.png') # logo swap
- self.assertContains(resp, 'test_microsite/css/test_microsite') # css override
- self.assertContains(resp, 'Test Microsite') # page title
+ self.assertContains(resp, 'This is a Test Site Overlay') # Overlay test message
+ self.assertContains(resp, 'test_site/images/header-logo.png') # logo swap
+ self.assertContains(resp, 'test_site/css/test_site') # css override
+ self.assertContains(resp, 'Test Site') # page title
# assert that test course display name is visible
self.assertContains(resp, 'Robot_Super_Course')
@@ -93,14 +93,14 @@ class TestMicrosites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
# assert that test course with 'visible_in_catalog' to True is showing up
self.assertContains(resp, 'visible_course')
- # assert that test course that is outside microsite is not visible
- self.assertNotContains(resp, 'Robot_Course_Outside_Microsite')
+ # assert that test course that is outside current configured site is not visible
+ self.assertNotContains(resp, 'Robot_Course_Outside_Site')
# assert that a course that has visible_in_catalog=False is not visible
self.assertNotContains(resp, 'Hidden_course')
# assert that footer template has been properly overriden on homepage
- self.assertContains(resp, 'This is a Test Microsite footer')
+ self.assertContains(resp, 'This is a Test Site footer')
# assert that the edX partners section is not in the HTML
self.assertNotContains(resp, '')
@@ -108,45 +108,45 @@ class TestMicrosites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
# assert that the edX partners tag line is not in the HTML
self.assertNotContains(resp, 'Explore free courses from')
- def test_not_microsite_anonymous_homepage_content(self):
+ def test_no_configuration_anonymous_homepage_content(self):
"""
- Make sure we see the right content on the homepage if we are not in a microsite
+ Make sure we see the right content on the homepage if there is no site configuration defined.
"""
resp = self.client.get('/')
self.assertEqual(resp.status_code, 200)
- # assert various branding definitions on this Microsite ARE NOT VISIBLE
+ # assert various branding definitions on this Site ARE NOT VISIBLE
- self.assertNotContains(resp, 'This is a Test Microsite Overlay') # Overlay test message
- self.assertNotContains(resp, 'test_microsite/images/header-logo.png') # logo swap
- self.assertNotContains(resp, 'test_microsite/css/test_microsite') # css override
- self.assertNotContains(resp, 'Test Microsite ') # page title
+ self.assertNotContains(resp, 'This is a Test Site Overlay') # Overlay test message
+ self.assertNotContains(resp, 'test_site/images/header-logo.png') # logo swap
+ self.assertNotContains(resp, 'test_site/css/test_site') # css override
+ self.assertNotContains(resp, 'Test Site ') # page title
- # assert that test course display name IS NOT VISIBLE, since that is a Microsite only course
+ # assert that test course display name IS NOT VISIBLE
self.assertNotContains(resp, 'Robot_Super_Course')
- # assert that test course that is outside microsite IS VISIBLE
- self.assertContains(resp, 'Robot_Course_Outside_Microsite')
+ # assert that test course that is outside site IS VISIBLE
+ self.assertContains(resp, 'Robot_Course_Outside_Site')
# assert that footer template has been properly overriden on homepage
- self.assertNotContains(resp, 'This is a Test Microsite footer')
+ self.assertNotContains(resp, 'This is a Test Site footer')
@override_settings(SITE_NAME=settings.MICROSITE_TEST_HOSTNAME)
- def test_microsite_anonymous_copyright_content(self):
+ def test_site_anonymous_copyright_content(self):
"""
- Verify that the copyright, when accessed via a Microsite domain, returns
+ Verify that the copyright, when accessed via a Site domain, returns
the expected 200 response
"""
resp = self.client.get('/copyright', HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
self.assertEqual(resp.status_code, 200)
- self.assertContains(resp, 'This is a copyright page for an Open edX microsite.')
+ self.assertContains(resp, 'This is a copyright page for an Open edX site.')
- def test_not_microsite_anonymous_copyright_content(self):
+ def test_not_site_anonymous_copyright_content(self):
"""
- Verify that the copyright page does not exist if we are not in a microsite
+ Verify that the copyright page does not exist if we are not in a configured site.
"""
resp = self.client.get('/copyright')
@@ -177,9 +177,9 @@ class TestMicrosites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
resp = self.client.get(reverse('root'), HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
self.assertEquals(resp.status_code, 200)
- def test_microsite_course_enrollment(self):
+ def test_site_course_enrollment(self):
"""
- Enroll user in a course scoped in a Microsite and one course outside of a Microsite
+ Enroll user in a course scoped in a Site and one course outside of a Site
and make sure that they are only visible in the right Dashboards
"""
self.setup_users()
@@ -187,21 +187,21 @@ class TestMicrosites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
email, password = self.STUDENT_INFO[1]
self.login(email, password)
self.enroll(self.course, True)
- self.enroll(self.course_outside_microsite, True)
+ self.enroll(self.course_outside_site, True)
- # Access the microsite dashboard and make sure the right courses appear
+ # Access the site dashboard and make sure the right courses appear
resp = self.client.get(reverse('dashboard'), HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
self.assertContains(resp, 'Robot_Super_Course')
- self.assertNotContains(resp, 'Robot_Course_Outside_Microsite')
+ self.assertNotContains(resp, 'Robot_Course_Outside_Site')
- # Now access the non-microsite dashboard and make sure the right courses appear
+ # Now access the non-site dashboard and make sure the right courses appear
resp = self.client.get(reverse('dashboard'))
self.assertNotContains(resp, 'Robot_Super_Course')
- self.assertContains(resp, 'Robot_Course_Outside_Microsite')
+ self.assertContains(resp, 'Robot_Course_Outside_Site')
- def test_microsite_course_custom_tabs(self):
+ def test_site_course_custom_tabs(self):
"""
- Enroll user in a course scoped in a Microsite and make sure that
+ Enroll user in a course scoped in a Site and make sure that
template with tabs is overridden
"""
self.setup_users()
@@ -212,12 +212,12 @@ class TestMicrosites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
resp = self.client.get(reverse('courseware', args=[unicode(self.course.id)]),
HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
- self.assertContains(resp, 'Test Microsite Tab:')
+ self.assertContains(resp, 'Test Site Tab:')
@override_settings(SITE_NAME=settings.MICROSITE_TEST_HOSTNAME)
def test_visible_about_page_settings(self):
"""
- Make sure the Microsite is honoring the visible_about_page permissions that is
+ Make sure the Site is honoring the visible_about_page permissions that is
set in configuration
"""
url = reverse('about_course', args=[self.course_with_visibility.id.to_deprecated_string()])
@@ -231,7 +231,7 @@ class TestMicrosites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
@override_settings(SITE_NAME=settings.MICROSITE_TEST_HOSTNAME)
def test_paid_course_registration(self):
"""
- Make sure that Microsite overrides on the ENABLE_SHOPPING_CART and
+ Make sure that Site overrides on the ENABLE_SHOPPING_CART and
ENABLE_PAID_COURSE_ENROLLMENTS are honored
"""
course_mode = CourseMode(
@@ -242,7 +242,7 @@ class TestMicrosites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
)
course_mode.save()
- # first try on the non microsite, which
+ # first try on the non site, which
# should pick up the global configuration (where ENABLE_PAID_COURSE_REGISTRATIONS = False)
url = reverse('about_course', args=[self.course_with_visibility.id.to_deprecated_string()])
resp = self.client.get(url)
@@ -250,7 +250,7 @@ class TestMicrosites(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertIn("Enroll in {}".format(self.course_with_visibility.id.course), resp.content)
self.assertNotIn("Add {} to Cart ($10)".format(self.course_with_visibility.id.course), resp.content)
- # now try on the microsite
+ # now try on the site
url = reverse('about_course', args=[self.course_with_visibility.id.to_deprecated_string()])
resp = self.client.get(url, HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
self.assertEqual(resp.status_code, 200)
diff --git a/lms/djangoapps/courseware/tests/test_views.py b/lms/djangoapps/courseware/tests/test_views.py
index 69cde1635c..9634deda15 100644
--- a/lms/djangoapps/courseware/tests/test_views.py
+++ b/lms/djangoapps/courseware/tests/test_views.py
@@ -1346,7 +1346,7 @@ class ProgressPageTests(ModuleStoreTestCase):
self.assertContains(resp, u"Download Your Certificate")
@ddt.data(
- *itertools.product(((48, 4, True), (48, 4, False)), (True, False))
+ *itertools.product(((49, 4, True), (49, 4, False)), (True, False))
)
@ddt.unpack
def test_query_counts(self, (sql_calls, mongo_calls, self_paced), self_paced_enabled):
diff --git a/lms/djangoapps/courseware/views/views.py b/lms/djangoapps/courseware/views/views.py
index 23e4693821..157ca566f9 100644
--- a/lms/djangoapps/courseware/views/views.py
+++ b/lms/djangoapps/courseware/views/views.py
@@ -77,7 +77,7 @@ from openedx.core.djangoapps.credit.api import (
is_user_eligible_for_credit,
is_credit_course
)
-from openedx.core.djangoapps.theming import helpers as theming_helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from shoppingcart.utils import is_shopping_cart_enabled
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
from student.models import UserTestGroup, CourseEnrollment
@@ -141,7 +141,7 @@ def courses(request):
if not settings.FEATURES.get('ENABLE_COURSE_DISCOVERY'):
courses_list = get_courses(request.user)
- if theming_helpers.get_value(
+ if configuration_helpers.get_value(
"ENABLE_COURSE_SORTING_BY_START_DATE",
settings.FEATURES["ENABLE_COURSE_SORTING_BY_START_DATE"]
):
@@ -542,7 +542,7 @@ def course_about(request, course_id):
course_details = CourseDetails.populate(course)
modes = CourseMode.modes_for_course_dict(course_key)
- if theming_helpers.get_value('ENABLE_MKTG_SITE', settings.FEATURES.get('ENABLE_MKTG_SITE', False)):
+ if configuration_helpers.get_value('ENABLE_MKTG_SITE', settings.FEATURES.get('ENABLE_MKTG_SITE', False)):
return redirect(reverse('info', args=[course.id.to_deprecated_string()]))
registered = registered_for_course(course, request.user)
@@ -834,7 +834,7 @@ def _get_cert_data(student, course, course_key, is_active, enrollment_mode):
not SoftwareSecurePhotoVerification.user_is_verified(student)
if missing_required_verification or cert_downloadable_status['is_unverified']:
- platform_name = theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
+ platform_name = configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
return CertData(
CertificateStatuses.unverified,
'Certificate unavailable',
@@ -1157,7 +1157,7 @@ def generate_user_cert(request, course_id):
log.info(u"Anon user trying to generate certificate for %s", course_id)
return HttpResponseBadRequest(
_('You must be signed in to {platform_name} to create a certificate.').format(
- platform_name=theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
+ platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
)
)
@@ -1273,7 +1273,7 @@ FINANCIAL_ASSISTANCE_HEADER = _(
' financial assistance program.'
).format(
percent_sign="%",
- platform_name=theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
+ platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
).split('\n')
@@ -1393,7 +1393,7 @@ def financial_assistance_form(request):
'student_faq_url': marketing_link('FAQ'),
'dashboard_url': reverse('dashboard'),
'account_settings_url': reverse('account_settings'),
- 'platform_name': theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ 'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
'user_details': {
'email': user.email,
'username': user.username,
diff --git a/lms/djangoapps/instructor/enrollment.py b/lms/djangoapps/instructor/enrollment.py
index d848c4dc24..3540593483 100644
--- a/lms/djangoapps/instructor/enrollment.py
+++ b/lms/djangoapps/instructor/enrollment.py
@@ -22,10 +22,9 @@ from submissions import api as sub_api # installed from the edx-submissions rep
from student.models import anonymous_id_for_user
from openedx.core.djangoapps.user_api.models import UserPreference
-from microsite_configuration import microsite
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError
-from openedx.core.djangoapps.theming import helpers as theming_helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger(__name__)
@@ -300,7 +299,7 @@ def get_email_params(course, auto_enroll, secure=True, course_key=None, display_
course_key = course_key or course.id.to_deprecated_string()
display_name = display_name or course.display_name_with_default_escaped
- stripped_site_name = microsite.get_value(
+ stripped_site_name = configuration_helpers.get_value(
'SITE_NAME',
settings.SITE_NAME
)
@@ -372,7 +371,7 @@ def send_mail_to_student(student, param_dict, language=None):
if 'display_name' in param_dict:
param_dict['course_name'] = param_dict['display_name']
- param_dict['site_name'] = microsite.get_value(
+ param_dict['site_name'] = configuration_helpers.get_value(
'SITE_NAME',
param_dict['site_name']
)
@@ -380,8 +379,8 @@ def send_mail_to_student(student, param_dict, language=None):
subject = None
message = None
- # see if we are running in a microsite and that there is an
- # activation email template definition available as configuration, if so, then render that
+ # see if there is an activation email template definition available as configuration,
+ # if so, then render that
message_type = param_dict['message']
email_template_dict = {
@@ -427,7 +426,7 @@ def send_mail_to_student(student, param_dict, language=None):
# Email subject *must not* contain newlines
subject = ''.join(subject.splitlines())
- from_address = theming_helpers.get_value(
+ from_address = configuration_helpers.get_value(
'email_from_address',
settings.DEFAULT_FROM_EMAIL
)
diff --git a/lms/djangoapps/instructor/paidcourse_enrollment_report.py b/lms/djangoapps/instructor/paidcourse_enrollment_report.py
index 1d627f6f05..557d58830e 100644
--- a/lms/djangoapps/instructor/paidcourse_enrollment_report.py
+++ b/lms/djangoapps/instructor/paidcourse_enrollment_report.py
@@ -8,10 +8,10 @@ from django.conf import settings
from django.utils.translation import ugettext as _
from courseware.courses import get_course_by_id
from instructor.enrollment_report import BaseAbstractEnrollmentReportProvider
-from microsite_configuration import microsite
from shoppingcart.models import RegistrationCodeRedemption, PaidCourseRegistration, CouponRedemption, OrderItem, \
InvoiceTransaction
from student.models import CourseEnrollment, ManualEnrollmentAudit
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
class PaidCourseEnrollmentReportProvider(BaseAbstractEnrollmentReportProvider):
@@ -29,7 +29,7 @@ class PaidCourseEnrollmentReportProvider(BaseAbstractEnrollmentReportProvider):
# check the user enrollment role
if user.is_staff:
- platform_name = microsite.get_value('platform_name', settings.PLATFORM_NAME)
+ platform_name = configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME)
enrollment_role = _('{platform_name} Staff').format(platform_name=platform_name)
elif is_course_staff:
enrollment_role = _('Course Staff')
diff --git a/lms/djangoapps/instructor/tests/test_api.py b/lms/djangoapps/instructor/tests/test_api.py
index 91d215aebf..481e565db6 100644
--- a/lms/djangoapps/instructor/tests/test_api.py
+++ b/lms/djangoapps/instructor/tests/test_api.py
@@ -40,7 +40,6 @@ from courseware.tests.factories import (
from courseware.tests.helpers import LoginEnrollmentTestCase
from django_comment_common.models import FORUM_ROLE_COMMUNITY_TA
from django_comment_common.utils import seed_permissions_roles
-from microsite_configuration import microsite
from shoppingcart.models import (
RegistrationCodeRedemption, Order, CouponRedemption,
PaidCourseRegistration, Coupon, Invoice, CourseRegistrationCode, CourseRegistrationCodeInvoiceItem,
@@ -71,6 +70,7 @@ from certificates.models import CertificateStatuses
from openedx.core.djangoapps.course_groups.cohorts import set_course_cohort_settings
from openedx.core.lib.xblock_utils import grade_histogram
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from .test_tools import msk_from_problem_urlname
@@ -958,7 +958,7 @@ class TestInstructorAPIEnrollment(SharedModuleStoreTestCase, LoginEnrollmentTest
cls.course = CourseFactory.create()
# Email URL values
- cls.site_name = microsite.get_value(
+ cls.site_name = configuration_helpers.get_value(
'SITE_NAME',
settings.SITE_NAME
)
@@ -1709,7 +1709,7 @@ class TestInstructorAPIBulkBetaEnrollment(SharedModuleStoreTestCase, LoginEnroll
super(TestInstructorAPIBulkBetaEnrollment, cls).setUpClass()
cls.course = CourseFactory.create()
# Email URL values
- cls.site_name = microsite.get_value(
+ cls.site_name = configuration_helpers.get_value(
'SITE_NAME',
settings.SITE_NAME
)
diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py
index ea870713f5..74838d8048 100644
--- a/lms/djangoapps/instructor/views/api.py
+++ b/lms/djangoapps/instructor/views/api.py
@@ -38,8 +38,6 @@ from util.json_request import JsonResponse, JsonResponseBadRequest
from util.views import require_global_staff
from instructor.views.instructor_task_helpers import extract_email_features, extract_task_features
-from microsite_configuration import microsite
-
from courseware.access import has_access
from courseware.courses import get_course_with_access, get_course_by_id
from django.contrib.auth.models import User
@@ -111,7 +109,7 @@ from opaque_keys.edx.keys import CourseKey, UsageKey
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from opaque_keys import InvalidKeyError
from openedx.core.djangoapps.course_groups.cohorts import is_course_cohorted
-from openedx.core.djangoapps.theming import helpers as theming_helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger(__name__)
@@ -287,7 +285,10 @@ def register_and_enroll_students(request, course_id): # pylint: disable=too-man
The failure will be messaged in a response in the browser.
"""
- if not microsite.get_value('ALLOW_AUTOMATED_SIGNUPS', settings.FEATURES.get('ALLOW_AUTOMATED_SIGNUPS', False)):
+ if not configuration_helpers.get_value(
+ 'ALLOW_AUTOMATED_SIGNUPS',
+ settings.FEATURES.get('ALLOW_AUTOMATED_SIGNUPS', False),
+ ):
return HttpResponseForbidden()
course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
@@ -534,7 +535,7 @@ def create_and_enroll_user(email, username, name, country, password, course_id,
'message': 'account_creation_and_enrollment',
'email_address': email,
'password': password,
- 'platform_name': microsite.get_value('platform_name', settings.PLATFORM_NAME),
+ 'platform_name': configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME),
})
send_mail_to_student(email, email_params)
except Exception as ex: # pylint: disable=broad-except
@@ -1198,7 +1199,7 @@ def get_students_features(request, course_id, csv=False): # pylint: disable=red
available_features = instructor_analytics.basic.AVAILABLE_FEATURES
- # Allow for microsites to be able to define additional columns.
+ # Allow for sites to be able to define additional columns.
# Note that adding additional columns has the potential to break
# the student profile report due to a character limit on the
# asynchronous job input which in this case is a JSON string
@@ -1206,7 +1207,7 @@ def get_students_features(request, course_id, csv=False): # pylint: disable=red
# TODO: Refactor the student profile report code to remove the list of columns
# that should be included in the report from the asynchronous job input.
# We need to clone the list because we modify it below
- query_features = list(microsite.get_value('student_profile_download_fields', []))
+ query_features = list(configuration_helpers.get_value('student_profile_download_fields', []))
if not query_features:
query_features = [
@@ -1691,15 +1692,15 @@ def generate_registration_codes(request, course_id):
)
registration_codes.append(generated_registration_code)
- site_name = microsite.get_value('SITE_NAME', 'localhost')
+ site_name = configuration_helpers.get_value('SITE_NAME', 'localhost')
quantity = course_code_number
discount = (float(quantity * course_price) - float(sale_price))
course_url = '{base_url}{course_about}'.format(
- base_url=microsite.get_value('SITE_NAME', settings.SITE_NAME),
+ base_url=configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME),
course_about=reverse('about_course', kwargs={'course_id': course_id.to_deprecated_string()})
)
dashboard_url = '{base_url}{dashboard}'.format(
- base_url=microsite.get_value('SITE_NAME', settings.SITE_NAME),
+ base_url=configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME),
dashboard=reverse('dashboard')
)
@@ -1709,7 +1710,7 @@ def generate_registration_codes(request, course_id):
log.exception('Exception at creating pdf file.')
pdf_file = None
- from_address = theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
+ from_address = configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
context = {
'invoice': sale_invoice,
'site_name': site_name,
@@ -1722,11 +1723,14 @@ def generate_registration_codes(request, course_id):
'registration_codes': registration_codes,
'currency_symbol': settings.PAID_COURSE_REGISTRATION_CURRENCY[1],
'course_url': course_url,
- 'platform_name': microsite.get_value('platform_name', settings.PLATFORM_NAME),
+ 'platform_name': configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME),
'dashboard_url': dashboard_url,
'contact_email': from_address,
- 'corp_address': microsite.get_value('invoice_corp_address', settings.INVOICE_CORP_ADDRESS),
- 'payment_instructions': microsite.get_value('invoice_payment_instructions', settings. INVOICE_PAYMENT_INSTRUCTIONS),
+ 'corp_address': configuration_helpers.get_value('invoice_corp_address', settings.INVOICE_CORP_ADDRESS),
+ 'payment_instructions': configuration_helpers.get_value(
+ 'invoice_payment_instructions',
+ settings. INVOICE_PAYMENT_INSTRUCTIONS,
+ ),
'date': time.strftime("%m/%d/%Y")
}
# composes registration codes invoice email
@@ -1740,11 +1744,11 @@ def generate_registration_codes(request, course_id):
csv_writer = csv.writer(csv_file)
for registration_code in registration_codes:
full_redeem_code_url = 'http://{base_url}{redeem_code_url}'.format(
- base_url=microsite.get_value('SITE_NAME', settings.SITE_NAME),
+ base_url=configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME),
redeem_code_url=reverse('register_code_redemption', kwargs={'registration_code': registration_code.code})
)
csv_writer.writerow([registration_code.code, full_redeem_code_url])
- finance_email = microsite.get_value('finance_email', settings.FINANCE_EMAIL)
+ finance_email = configuration_helpers.get_value('finance_email', settings.FINANCE_EMAIL)
if finance_email:
# append the finance email into the recipient_list
recipient_list.append(finance_email)
@@ -2485,13 +2489,13 @@ def send_email(request, course_id):
subject = request.POST.get("subject")
message = request.POST.get("message")
- # allow two branding points to come from Microsites: which CourseEmailTemplate should be used
+ # allow two branding points to come from Site Configuration: which CourseEmailTemplate should be used
# and what the 'from' field in the email should be
#
- # If these are None (because we are not in a Microsite or they are undefined in Microsite config) than
+ # If these are None (there is no site configuration enabled for the current site) than
# the system will use normal system defaults
- template_name = microsite.get_value('course_email_template_name')
- from_addr = microsite.get_value('course_email_from_addr')
+ template_name = configuration_helpers.get_value('course_email_template_name')
+ from_addr = configuration_helpers.get_value('course_email_from_addr')
# Create the CourseEmail object. This is saved immediately, so that
# any transaction that has been pending up to this point will also be
diff --git a/lms/djangoapps/instructor_analytics/basic.py b/lms/djangoapps/instructor_analytics/basic.py
index 86bc919a52..49d108cf0b 100644
--- a/lms/djangoapps/instructor_analytics/basic.py
+++ b/lms/djangoapps/instructor_analytics/basic.py
@@ -17,7 +17,6 @@ from django.core.serializers.json import DjangoJSONEncoder
from django.core.urlresolvers import reverse
from opaque_keys.edx.keys import UsageKey
import xmodule.graders as xmgraders
-from microsite_configuration import microsite
from student.models import CourseEnrollmentAllowed
from edx_proctoring.api import get_all_exam_attempts
from courseware.models import StudentModule
@@ -25,6 +24,7 @@ from certificates.models import GeneratedCertificate
from django.db.models import Count
from certificates.models import CertificateStatuses
from grades.context import grading_context_for_course
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
STUDENT_FEATURES = ('id', 'username', 'first_name', 'last_name', 'is_staff', 'email')
@@ -430,7 +430,7 @@ def course_registration_features(features, registration_codes, csv_type):
:param features:
:param csv_type:
"""
- site_name = microsite.get_value('SITE_NAME', settings.SITE_NAME)
+ site_name = configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME)
registration_features = [x for x in COURSE_REGISTRATION_FEATURES if x in features]
course_registration_dict = dict((feature, getattr(registration_code, feature)) for feature in registration_features)
diff --git a/lms/djangoapps/oauth_dispatch/views.py b/lms/djangoapps/oauth_dispatch/views.py
index 240ca44e77..85a27acc87 100644
--- a/lms/djangoapps/oauth_dispatch/views.py
+++ b/lms/djangoapps/oauth_dispatch/views.py
@@ -16,7 +16,6 @@ from django.views.generic import View
from edx_oauth2_provider import views as dop_views # django-oauth2-provider views
from oauth2_provider import models as dot_models, views as dot_views # django-oauth-toolkit
-from openedx.core.djangoapps.theming import helpers
from openedx.core.lib.token_utils import JwtBuilder
from . import adapters
diff --git a/lms/djangoapps/shoppingcart/models.py b/lms/djangoapps/shoppingcart/models.py
index 5c728a52f7..8fb22c590d 100644
--- a/lms/djangoapps/shoppingcart/models.py
+++ b/lms/djangoapps/shoppingcart/models.py
@@ -33,7 +33,6 @@ from django.core.mail.message import EmailMessage
from xmodule.modulestore.django import modulestore
from eventtracking import tracker
-from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value
from courseware.courses import get_course_by_id
from config_models.models import ConfigurationModel
from course_modes.models import CourseMode
@@ -52,8 +51,8 @@ from .exceptions import (
UnexpectedOrderItemStatus,
ItemNotFoundInCartException
)
-from microsite_configuration import microsite
from shoppingcart.pdf import PDFInvoice
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger("shoppingcart")
@@ -272,7 +271,9 @@ class Order(models.Model):
if is_order_type_business:
for cart_item in cart_items:
if hasattr(cart_item, 'paidcourseregistration'):
- course_reg_code_item = CourseRegCodeItem.add_to_order(self, cart_item.paidcourseregistration.course_id, cart_item.qty)
+ course_reg_code_item = CourseRegCodeItem.add_to_order(
+ self, cart_item.paidcourseregistration.course_id, cart_item.qty,
+ )
# update the discounted prices if coupon redemption applied
course_reg_code_item.list_price = cart_item.list_price
course_reg_code_item.unit_cost = cart_item.unit_cost
@@ -282,7 +283,9 @@ class Order(models.Model):
else:
for cart_item in cart_items:
if hasattr(cart_item, 'courseregcodeitem'):
- paid_course_registration = PaidCourseRegistration.add_to_order(self, cart_item.courseregcodeitem.course_id)
+ paid_course_registration = PaidCourseRegistration.add_to_order(
+ self, cart_item.courseregcodeitem.course_id,
+ )
# update the discounted prices if coupon redemption applied
paid_course_registration.list_price = cart_item.list_price
paid_course_registration.unit_cost = cart_item.unit_cost
@@ -370,7 +373,7 @@ class Order(models.Model):
dashboard=reverse('dashboard')
)
try:
- from_address = microsite.get_value(
+ from_address = configuration_helpers.get_value(
'email_from_address',
settings.PAYMENT_SUPPORT_EMAIL
)
@@ -391,9 +394,11 @@ class Order(models.Model):
username=self.user.username, email=self.user.email
),
'has_billing_info': settings.FEATURES['STORE_BILLING_INFO'],
- 'platform_name': microsite.get_value('platform_name', settings.PLATFORM_NAME),
- 'payment_support_email': microsite.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL),
- 'payment_email_signature': microsite.get_value('payment_email_signature'),
+ 'platform_name': configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME),
+ 'payment_support_email': configuration_helpers.get_value(
+ 'payment_support_email', settings.PAYMENT_SUPPORT_EMAIL,
+ ),
+ 'payment_email_signature': configuration_helpers.get_value('payment_email_signature'),
}
)
email = EmailMessage(
@@ -463,7 +468,7 @@ class Order(models.Model):
# this should return all of the objects with the correct types of the
# subclasses
orderitems = OrderItem.objects.filter(order=self).select_subclasses()
- site_name = microsite.get_value('SITE_NAME', settings.SITE_NAME)
+ site_name = configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME)
if self.order_type == OrderTypes.BUSINESS:
self.update_order_type()
@@ -1909,7 +1914,7 @@ class CertificateItem(OrderItem):
user_email=course_enrollment.user.email,
order_number=order_number)
to_email = [settings.PAYMENT_SUPPORT_EMAIL]
- from_email = microsite.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)
+ from_email = configuration_helpers.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)
try:
send_mail(subject, message, from_email, to_email, fail_silently=False)
except Exception as exception: # pylint: disable=broad-except
@@ -2005,7 +2010,7 @@ class CertificateItem(OrderItem):
is_professional_mode_verified = self.course_enrollment.is_professional_enrollment()
if is_enrollment_mode_verified:
- domain = microsite.get_value('SITE_NAME', settings.SITE_NAME)
+ domain = configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME)
path = reverse('verify_student_verify_now', kwargs={'course_id': unicode(self.course_id)})
verification_url = "http://{domain}{path}".format(domain=domain, path=path)
@@ -2197,7 +2202,7 @@ class Donation(OrderItem):
u"We greatly appreciate this generous contribution and your support of the {platform_name} mission. "
u"This receipt was prepared to support charitable contributions for tax purposes. "
u"We confirm that neither goods nor services were provided in exchange for this gift."
- ).format(platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME))
+ ).format(platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME))
@classmethod
def _line_item_description(cls, course_id=None):
@@ -2230,8 +2235,9 @@ class Donation(OrderItem):
# The donation is for the organization as a whole, not a specific course
else:
- return _(u"Donation for {platform_name}").format(platform_name=get_themed_value('PLATFORM_NAME',
- settings.PLATFORM_NAME))
+ return _(u"Donation for {platform_name}").format(
+ platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ )
@property
def single_item_receipt_context(self):
@@ -2256,8 +2262,8 @@ class Donation(OrderItem):
data['name'] = unicode(self.course_id)
data['category'] = unicode(self.course_id.org)
else:
- data['name'] = get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)
- data['category'] = get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)
+ data['name'] = configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
+ data['category'] = configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
return data
@property
diff --git a/lms/djangoapps/shoppingcart/pdf.py b/lms/djangoapps/shoppingcart/pdf.py
index 86f39ca0d2..09f1504e30 100644
--- a/lms/djangoapps/shoppingcart/pdf.py
+++ b/lms/djangoapps/shoppingcart/pdf.py
@@ -12,8 +12,8 @@ from reportlab.lib.units import mm
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.platypus import Paragraph
from reportlab.platypus.tables import Table, TableStyle
-from microsite_configuration import microsite
from xmodule.modulestore.django import ModuleI18nService
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger("PDF Generation")
@@ -90,24 +90,26 @@ class PDFInvoice(object):
# From settings
self.currency = settings.PAID_COURSE_REGISTRATION_CURRENCY[1]
- self.logo_path = microsite.get_value("PDF_RECEIPT_LOGO_PATH", settings.PDF_RECEIPT_LOGO_PATH)
- self.cobrand_logo_path = microsite.get_value(
+ self.logo_path = configuration_helpers.get_value("PDF_RECEIPT_LOGO_PATH", settings.PDF_RECEIPT_LOGO_PATH)
+ self.cobrand_logo_path = configuration_helpers.get_value(
"PDF_RECEIPT_COBRAND_LOGO_PATH", settings.PDF_RECEIPT_COBRAND_LOGO_PATH
)
- self.tax_label = microsite.get_value("PDF_RECEIPT_TAX_ID_LABEL", settings.PDF_RECEIPT_TAX_ID_LABEL)
- self.tax_id = microsite.get_value("PDF_RECEIPT_TAX_ID", settings.PDF_RECEIPT_TAX_ID)
- self.footer_text = microsite.get_value("PDF_RECEIPT_FOOTER_TEXT", settings.PDF_RECEIPT_FOOTER_TEXT)
- self.disclaimer_text = microsite.get_value("PDF_RECEIPT_DISCLAIMER_TEXT", settings.PDF_RECEIPT_DISCLAIMER_TEXT)
- self.billing_address_text = microsite.get_value(
+ self.tax_label = configuration_helpers.get_value("PDF_RECEIPT_TAX_ID_LABEL", settings.PDF_RECEIPT_TAX_ID_LABEL)
+ self.tax_id = configuration_helpers.get_value("PDF_RECEIPT_TAX_ID", settings.PDF_RECEIPT_TAX_ID)
+ self.footer_text = configuration_helpers.get_value("PDF_RECEIPT_FOOTER_TEXT", settings.PDF_RECEIPT_FOOTER_TEXT)
+ self.disclaimer_text = configuration_helpers.get_value(
+ "PDF_RECEIPT_DISCLAIMER_TEXT", settings.PDF_RECEIPT_DISCLAIMER_TEXT,
+ )
+ self.billing_address_text = configuration_helpers.get_value(
"PDF_RECEIPT_BILLING_ADDRESS", settings.PDF_RECEIPT_BILLING_ADDRESS
)
- self.terms_conditions_text = microsite.get_value(
+ self.terms_conditions_text = configuration_helpers.get_value(
"PDF_RECEIPT_TERMS_AND_CONDITIONS", settings.PDF_RECEIPT_TERMS_AND_CONDITIONS
)
- self.brand_logo_height = microsite.get_value(
+ self.brand_logo_height = configuration_helpers.get_value(
"PDF_RECEIPT_LOGO_HEIGHT_MM", settings.PDF_RECEIPT_LOGO_HEIGHT_MM
) * mm
- self.cobrand_logo_height = microsite.get_value(
+ self.cobrand_logo_height = configuration_helpers.get_value(
"PDF_RECEIPT_COBRAND_LOGO_HEIGHT_MM", settings.PDF_RECEIPT_COBRAND_LOGO_HEIGHT_MM
) * mm
diff --git a/lms/djangoapps/shoppingcart/processors/CyberSource.py b/lms/djangoapps/shoppingcart/processors/CyberSource.py
index 0e6c12939b..50bbabf7aa 100644
--- a/lms/djangoapps/shoppingcart/processors/CyberSource.py
+++ b/lms/djangoapps/shoppingcart/processors/CyberSource.py
@@ -33,7 +33,7 @@ from edxmako.shortcuts import render_to_string
from shoppingcart.models import Order
from shoppingcart.processors.exceptions import *
from shoppingcart.processors.helpers import get_processor_config
-from microsite_configuration import microsite
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
def process_postpay_callback(params, **kwargs):
@@ -243,8 +243,8 @@ def record_purchase(params, order):
def get_processor_decline_html(params):
"""Have to parse through the error codes to return a helpful message"""
- # see if we have an override in the microsites
- payment_support_email = microsite.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)
+ # see if we have an override in the site configuration
+ payment_support_email = configuration_helpers.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)
msg = _(
"Sorry! Our payment processor did not accept your payment. "
@@ -267,8 +267,8 @@ def get_processor_decline_html(params):
def get_processor_exception_html(exception):
"""Return error HTML associated with exception"""
- # see if we have an override in the microsites
- payment_support_email = microsite.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)
+ # see if we have an override in the site configuration
+ payment_support_email = configuration_helpers.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)
if isinstance(exception, CCProcessorDataException):
msg = _(
"Sorry! Our payment processor sent us back a payment confirmation "
diff --git a/lms/djangoapps/shoppingcart/processors/CyberSource2.py b/lms/djangoapps/shoppingcart/processors/CyberSource2.py
index a5bd8da5b6..1410f31683 100644
--- a/lms/djangoapps/shoppingcart/processors/CyberSource2.py
+++ b/lms/djangoapps/shoppingcart/processors/CyberSource2.py
@@ -37,7 +37,7 @@ from edxmako.shortcuts import render_to_string
from shoppingcart.models import Order
from shoppingcart.processors.exceptions import *
from shoppingcart.processors.helpers import get_processor_config
-from microsite_configuration import microsite
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger(__name__)
@@ -461,7 +461,7 @@ def _get_processor_decline_html(params):
unicode: The rendered HTML.
"""
- payment_support_email = microsite.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)
+ payment_support_email = configuration_helpers.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)
return _format_error_html(
_(
"Sorry! Our payment processor did not accept your payment. "
@@ -491,7 +491,7 @@ def _get_processor_exception_html(exception):
unicode: The rendered HTML.
"""
- payment_support_email = microsite.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)
+ payment_support_email = configuration_helpers.get_value('payment_support_email', settings.PAYMENT_SUPPORT_EMAIL)
if isinstance(exception, CCProcessorDataException):
return _format_error_html(
_(
diff --git a/lms/djangoapps/shoppingcart/processors/helpers.py b/lms/djangoapps/shoppingcart/processors/helpers.py
index 69461df508..953c0c5102 100644
--- a/lms/djangoapps/shoppingcart/processors/helpers.py
+++ b/lms/djangoapps/shoppingcart/processors/helpers.py
@@ -4,13 +4,13 @@ These methods should be shared among all processor implementations,
but should NOT be imported by modules outside this package.
"""
from django.conf import settings
-from microsite_configuration import microsite
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
def get_processor_config():
"""
Return a dictionary of configuration settings for the active credit card processor.
- If we're in a microsite and overrides are available, return those instead.
+ If configuration overrides are available, return those instead.
Returns:
dict
@@ -21,10 +21,10 @@ def get_processor_config():
settings.CC_PROCESSOR_NAME, {}
)
- # Check whether we're in a microsite that overrides our configuration
- # If so, find the microsite-specific configuration in the 'microsites'
+ # Check whether configuration override exists,
+ # If so, find the configuration-specific cybersource config in the configurations.
# sub-key of the normal processor configuration.
- config_key = microsite.get_value('cybersource_config_key')
+ config_key = configuration_helpers.get_value('cybersource_config_key')
if config_key:
config = config['microsites'][config_key]
diff --git a/lms/djangoapps/shoppingcart/processors/tests/test_CyberSource.py b/lms/djangoapps/shoppingcart/processors/tests/test_CyberSource.py
index d719e06f89..3d1117feb5 100644
--- a/lms/djangoapps/shoppingcart/processors/tests/test_CyberSource.py
+++ b/lms/djangoapps/shoppingcart/processors/tests/test_CyberSource.py
@@ -38,7 +38,7 @@ TEST_CC_PROCESSOR = {
'ORDERPAGE_VERSION': '7',
'PURCHASE_ENDPOINT': '',
'microsites': {
- 'test_microsite': {
+ 'test_site': {
'SHARED_SECRET': 'secret_override',
'MERCHANT_ID': 'edx_test_override',
'SERIAL_NUMBER': '12345_override',
@@ -50,12 +50,12 @@ TEST_CC_PROCESSOR = {
}
-def fakemicrosite(name, default=None):
+def fake_site(name, default=None): # pylint: disable=unused-argument
"""
- This is a test mocking function to return a microsite configuration
+ This is a test mocking function to return a site configuration
"""
if name == 'cybersource_config_key':
- return 'test_microsite'
+ return 'test_site'
else:
return None
@@ -70,12 +70,12 @@ class CyberSourceTests(TestCase):
self.assertEqual(settings.CC_PROCESSOR['CyberSource']['MERCHANT_ID'], 'edx_test')
self.assertEqual(settings.CC_PROCESSOR['CyberSource']['SHARED_SECRET'], 'secret')
- def test_microsite_no_override_settings(self):
+ def test_site_no_override_settings(self):
self.assertEqual(get_processor_config()['MERCHANT_ID'], 'edx_test')
self.assertEqual(get_processor_config()['SHARED_SECRET'], 'secret')
- @patch("microsite_configuration.microsite.get_value", fakemicrosite)
- def test_microsite_override_settings(self):
+ @patch("openedx.core.djangoapps.site_configuration.helpers.get_value", fake_site)
+ def test_site_override_settings(self):
self.assertEqual(get_processor_config()['MERCHANT_ID'], 'edx_test_override')
self.assertEqual(get_processor_config()['SHARED_SECRET'], 'secret_override')
diff --git a/lms/djangoapps/shoppingcart/tests/test_microsites.py b/lms/djangoapps/shoppingcart/tests/test_configuration_overrides.py
similarity index 56%
rename from lms/djangoapps/shoppingcart/tests/test_microsites.py
rename to lms/djangoapps/shoppingcart/tests/test_configuration_overrides.py
index b0dd3110c1..1b68e2c0cb 100644
--- a/lms/djangoapps/shoppingcart/tests/test_microsites.py
+++ b/lms/djangoapps/shoppingcart/tests/test_configuration_overrides.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""
-Tests for Microsite Dashboard with Shopping Cart History
+Dashboard with Shopping Cart History tests with configuration overrides.
"""
import mock
@@ -19,32 +19,25 @@ from course_modes.models import CourseMode
def fake_all_orgs(default=None): # pylint: disable=unused-argument
"""
- create a fake list of all microsites
+ Method to return fake orgs,
"""
return set(['fakeX', 'fooX'])
-def fakex_microsite(name, default=None): # pylint: disable=unused-argument
+def fake_site(name, default=None): # pylint: disable=unused-argument
"""
- create a fake microsite site name
+ Method to return a fake site name.
"""
return 'fakeX'
-def non_microsite(name, default=None): # pylint: disable=unused-argument
- """
- create a fake microsite site name
- """
- return None
-
-
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_PAID_COURSE_REGISTRATION': True})
-class TestOrderHistoryOnMicrositeDashboard(ModuleStoreTestCase):
+class TestOrderHistoryOnSiteDashboard(ModuleStoreTestCase):
"""
- Test for microsite dashboard order history
+ Test for dashboard order history site configuration overrides.
"""
def setUp(self):
- super(TestOrderHistoryOnMicrositeDashboard, self).setUp()
+ super(TestOrderHistoryOnSiteDashboard, self).setUp()
patcher = patch('student.models.tracker')
self.mock_tracker = patcher.start()
@@ -54,7 +47,7 @@ class TestOrderHistoryOnMicrositeDashboard(ModuleStoreTestCase):
self.addCleanup(patcher.stop)
- # First Order with our (fakeX) microsite's course.
+ # First Order with our (fakeX) site's course.
course1 = CourseFactory.create(org='fakeX', number='999', display_name='fakeX Course')
course1_key = course1.id
course1_mode = CourseMode(course_id=course1_key,
@@ -66,9 +59,9 @@ class TestOrderHistoryOnMicrositeDashboard(ModuleStoreTestCase):
cart = Order.get_cart_for_user(self.user)
PaidCourseRegistration.add_to_order(cart, course1_key)
cart.purchase(first='FirstNameTesting123', street1='StreetTesting123')
- self.orderid_microsite = cart.id
+ self.fakex_site_order_id = cart.id
- # Second Order with another(fooX) microsite's course
+ # Second Order with another(fooX) site's course
course2 = CourseFactory.create(org='fooX', number='888', display_name='fooX Course')
course2_key = course2.id
course2_mode = CourseMode(course_id=course2.id,
@@ -80,9 +73,9 @@ class TestOrderHistoryOnMicrositeDashboard(ModuleStoreTestCase):
cart = Order.get_cart_for_user(self.user)
PaidCourseRegistration.add_to_order(cart, course2_key)
cart.purchase(first='FirstNameTesting123', street1='StreetTesting123')
- self.orderid_other_microsite = cart.id
+ self.foox_site_order_id = cart.id
- # Third Order with course not attributed to any microsite.
+ # Third Order with course not attributed to any site.
course3 = CourseFactory.create(org='otherorg', number='777', display_name='otherorg Course')
course3_key = course3.id
course3_mode = CourseMode(course_id=course3.id,
@@ -94,9 +87,9 @@ class TestOrderHistoryOnMicrositeDashboard(ModuleStoreTestCase):
cart = Order.get_cart_for_user(self.user)
PaidCourseRegistration.add_to_order(cart, course3_key)
cart.purchase(first='FirstNameTesting123', street1='StreetTesting123')
- self.orderid_non_microsite = cart.id
+ self.order_id = cart.id
- # Fourth Order with course not attributed to any microsite but with a CertificateItem
+ # Fourth Order with course not attributed to any site but with a CertificateItem
course4 = CourseFactory.create(org='otherorg', number='888')
course4_key = course4.id
course4_mode = CourseMode(course_id=course4.id,
@@ -108,58 +101,61 @@ class TestOrderHistoryOnMicrositeDashboard(ModuleStoreTestCase):
cart = Order.get_cart_for_user(self.user)
CertificateItem.add_to_order(cart, course4_key, 20.0, 'verified')
cart.purchase(first='FirstNameTesting123', street1='StreetTesting123')
- self.orderid_cert_non_microsite = cart.id
+ self.certificate_order_id = cart.id
- # Fifth Order with course not attributed to any microsite but with a Donation
+ # Fifth Order with course not attributed to any site but with a Donation
course5 = CourseFactory.create(org='otherorg', number='999')
course5_key = course5.id
cart = Order.get_cart_for_user(self.user)
Donation.add_to_order(cart, 20.0, course5_key)
cart.purchase(first='FirstNameTesting123', street1='StreetTesting123')
- self.orderid_donation = cart.id
+ self.donation_order_id = cart.id
# also add a donation not associated with a course to make sure the None case works OK
Donation.add_to_order(cart, 10.0, None)
cart.purchase(first='FirstNameTesting123', street1='StreetTesting123')
- self.orderid_courseless_donation = cart.id
+ self.courseless_donation_order_id = cart.id
- @mock.patch("microsite_configuration.microsite.get_value", fakex_microsite)
- @mock.patch("microsite_configuration.microsite.get_all_orgs", fake_all_orgs)
- def test_when_in_microsite_shows_orders_with_microsite_courses_only(self):
+ @mock.patch("openedx.core.djangoapps.site_configuration.helpers.get_value", fake_site)
+ @mock.patch("openedx.core.djangoapps.site_configuration.helpers.get_all_orgs", fake_all_orgs)
+ def test_shows_orders_with_current_site_courses_only(self):
self.client.login(username=self.user.username, password="password")
response = self.client.get(reverse("dashboard"))
- receipt_url_microsite_course = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.orderid_microsite})
- receipt_url_microsite_course2 = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.orderid_other_microsite})
- receipt_url_non_microsite = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.orderid_non_microsite})
- receipt_url_cert_non_microsite = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.orderid_cert_non_microsite})
- receipt_url_donation = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.orderid_donation})
+ receipt_url_course = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.fakex_site_order_id})
+ receipt_url_course2 = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.foox_site_order_id})
+ receipt_url = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.order_id})
+ receipt_url_cert = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.certificate_order_id})
+ receipt_url_donation = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.donation_order_id})
# We need to decode because of these chars: © & ▸
content = response.content.decode('utf-8')
- self.assertIn(receipt_url_microsite_course, content)
- self.assertNotIn(receipt_url_microsite_course2, content)
- self.assertNotIn(receipt_url_non_microsite, content)
- self.assertNotIn(receipt_url_cert_non_microsite, content)
+ self.assertIn(receipt_url_course, content)
+ self.assertNotIn(receipt_url_course2, content)
+ self.assertNotIn(receipt_url, content)
+ self.assertNotIn(receipt_url_cert, content)
self.assertNotIn(receipt_url_donation, content)
- @mock.patch("microsite_configuration.microsite.get_value", non_microsite)
- @mock.patch("microsite_configuration.microsite.get_all_orgs", fake_all_orgs)
- def test_when_not_in_microsite_shows_orders_with_non_microsite_courses_only(self):
+ @mock.patch("openedx.core.djangoapps.site_configuration.helpers.get_value", mock.Mock(return_value=None))
+ @mock.patch("openedx.core.djangoapps.site_configuration.helpers.get_all_orgs", fake_all_orgs)
+ def test_shows_orders_with_non_site_courses_only_when_no_configuration_override_exists(self):
self.client.login(username=self.user.username, password="password")
response = self.client.get(reverse("dashboard"))
- receipt_url_microsite_course = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.orderid_microsite})
- receipt_url_microsite_course2 = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.orderid_other_microsite})
- receipt_url_non_microsite = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.orderid_non_microsite})
- receipt_url_cert_non_microsite = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.orderid_cert_non_microsite})
- receipt_url_donation = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.orderid_donation})
- receipt_url_courseless_donation = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.orderid_courseless_donation})
+ receipt_url_course = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.fakex_site_order_id})
+ receipt_url_course2 = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.foox_site_order_id})
+ receipt_url = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.order_id})
+ receipt_url_cert = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.certificate_order_id})
+ receipt_url_donation = reverse('shoppingcart.views.show_receipt', kwargs={'ordernum': self.donation_order_id})
+ receipt_url_courseless_donation = reverse(
+ 'shoppingcart.views.show_receipt',
+ kwargs={'ordernum': self.courseless_donation_order_id},
+ )
# We need to decode because of these chars: © & ▸
content = response.content.decode('utf-8')
- self.assertNotIn(receipt_url_microsite_course, content)
- self.assertNotIn(receipt_url_microsite_course2, content)
- self.assertIn(receipt_url_non_microsite, content)
- self.assertIn(receipt_url_cert_non_microsite, content)
+ self.assertNotIn(receipt_url_course, content)
+ self.assertNotIn(receipt_url_course2, content)
+ self.assertIn(receipt_url, content)
+ self.assertIn(receipt_url_cert, content)
self.assertIn(receipt_url_donation, content)
self.assertIn(receipt_url_courseless_donation, content)
diff --git a/lms/djangoapps/shoppingcart/utils.py b/lms/djangoapps/shoppingcart/utils.py
index 75fe69f0ad..8eeb536db5 100644
--- a/lms/djangoapps/shoppingcart/utils.py
+++ b/lms/djangoapps/shoppingcart/utils.py
@@ -3,13 +3,13 @@ Utility methods for the Shopping Cart app
"""
from django.conf import settings
-from microsite_configuration import microsite
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import PDFPageAggregator
from pdfminer.pdfpage import PDFPage
from pdfminer.layout import LAParams, LTTextBox, LTTextLine, LTFigure
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
def is_shopping_cart_enabled():
@@ -17,12 +17,12 @@ def is_shopping_cart_enabled():
Utility method to check the various configuration to verify that
all of the settings have been enabled
"""
- enable_paid_course_registration = microsite.get_value(
+ enable_paid_course_registration = configuration_helpers.get_value(
'ENABLE_PAID_COURSE_REGISTRATION',
settings.FEATURES.get('ENABLE_PAID_COURSE_REGISTRATION')
)
- enable_shopping_cart = microsite.get_value(
+ enable_shopping_cart = configuration_helpers.get_value(
'ENABLE_SHOPPING_CART',
settings.FEATURES.get('ENABLE_SHOPPING_CART')
)
diff --git a/lms/djangoapps/shoppingcart/views.py b/lms/djangoapps/shoppingcart/views.py
index 771b1551c9..988e023f59 100644
--- a/lms/djangoapps/shoppingcart/views.py
+++ b/lms/djangoapps/shoppingcart/views.py
@@ -20,7 +20,6 @@ from django.views.decorators.csrf import csrf_exempt
from util.bad_request_rate_limiter import BadRequestRateLimiter
from util.date_utils import get_default_time_display
from django.contrib.auth.decorators import login_required
-from microsite_configuration import microsite
from edxmako.shortcuts import render_to_response
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from opaque_keys.edx.locator import CourseLocator
@@ -51,6 +50,7 @@ from .processors import (
import json
from .decorators import enforce_shopping_cart_enabled
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger("shoppingcart")
@@ -169,7 +169,7 @@ def show_cart(request):
cart = Order.get_cart_for_user(request.user)
is_any_course_expired, expired_cart_items, expired_cart_item_names, valid_cart_item_tuples = \
verify_for_closed_enrollment(request.user, cart)
- site_name = microsite.get_value('SITE_NAME', settings.SITE_NAME)
+ site_name = configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME)
if is_any_course_expired:
for expired_item in expired_cart_items:
@@ -190,7 +190,7 @@ def show_cart(request):
'form_html': form_html,
'currency_symbol': settings.PAID_COURSE_REGISTRATION_CURRENCY[1],
'currency': settings.PAID_COURSE_REGISTRATION_CURRENCY[0],
- 'enable_bulk_purchase': microsite.get_value('ENABLE_SHOPPING_CART_BULK_PURCHASE', True)
+ 'enable_bulk_purchase': configuration_helpers.get_value('ENABLE_SHOPPING_CART_BULK_PURCHASE', True)
}
return render_to_response("shoppingcart/shopping_cart.html", context)
@@ -310,7 +310,7 @@ def register_code_redemption(request, registration_code):
"""
# Add some rate limiting here by re-using the RateLimitMixin as a helper class
- site_name = microsite.get_value('SITE_NAME', settings.SITE_NAME)
+ site_name = configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME)
limiter = BadRequestRateLimiter()
if limiter.is_rate_limit_exceeded(request):
AUDIT_LOG.warning("Rate limit exceeded in registration code redemption.")
@@ -719,7 +719,7 @@ def billing_details(request):
'form_html': form_html,
'currency_symbol': settings.PAID_COURSE_REGISTRATION_CURRENCY[1],
'currency': settings.PAID_COURSE_REGISTRATION_CURRENCY[0],
- 'site_name': microsite.get_value('SITE_NAME', settings.SITE_NAME),
+ 'site_name': configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME),
}
return render_to_response("shoppingcart/billing_details.html", context)
elif request.method == "POST":
@@ -914,7 +914,7 @@ def _show_receipt_html(request, order):
'shoppingcart_items': shoppingcart_items,
'any_refunds': any_refunds,
'instructions': instructions,
- 'site_name': microsite.get_value('SITE_NAME', settings.SITE_NAME),
+ 'site_name': configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME),
'order_type': order_type,
'appended_course_names': appended_course_names,
'appended_recipient_emails': appended_recipient_emails,
diff --git a/lms/djangoapps/static_template_view/tests/test_views.py b/lms/djangoapps/static_template_view/tests/test_views.py
index 99bf12f348..92ab0e4db2 100644
--- a/lms/djangoapps/static_template_view/tests/test_views.py
+++ b/lms/djangoapps/static_template_view/tests/test_views.py
@@ -68,7 +68,7 @@ class MarketingSiteViewTests(TestCase):
# check response with branding
resp = self.client.get(url, HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME)
- self.assertContains(resp, settings.MICROSITE_CONFIGURATION['test_microsite']['email_from_address'])
+ self.assertContains(resp, settings.MICROSITE_CONFIGURATION['test_site']['email_from_address'])
def test_500_microsites(self):
"""
@@ -84,12 +84,12 @@ class MarketingSiteViewTests(TestCase):
self.assertContains(
resp,
'There has been a 500 error on the {platform_name} servers'.format(
- platform_name=settings.MICROSITE_CONFIGURATION['test_microsite']['platform_name']
+ platform_name=settings.MICROSITE_CONFIGURATION['test_site']['platform_name']
),
status_code=500
)
self.assertContains(
resp,
- settings.MICROSITE_CONFIGURATION['test_microsite']['email_from_address'],
+ settings.MICROSITE_CONFIGURATION['test_site']['email_from_address'],
status_code=500
)
diff --git a/lms/djangoapps/student_account/test/test_views.py b/lms/djangoapps/student_account/test/test_views.py
index 3fe25ae276..71613757c2 100644
--- a/lms/djangoapps/student_account/test/test_views.py
+++ b/lms/djangoapps/student_account/test/test_views.py
@@ -375,7 +375,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
reverse("signin_user"),
HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME
)
- self.assertContains(resp, "Log into your Test Microsite Account")
+ self.assertContains(resp, "Log into your Test Site Account")
self.assertContains(resp, "login-form")
def test_microsite_uses_old_register_page(self):
@@ -385,7 +385,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
reverse("register_user"),
HTTP_HOST=settings.MICROSITE_TEST_HOSTNAME
)
- self.assertContains(resp, "Register for Test Microsite")
+ self.assertContains(resp, "Register for Test Site")
self.assertContains(resp, "register-form")
def test_login_registration_xframe_protected(self):
diff --git a/lms/djangoapps/student_account/views.py b/lms/djangoapps/student_account/views.py
index e93f704a8c..33f681a6fd 100644
--- a/lms/djangoapps/student_account/views.py
+++ b/lms/djangoapps/student_account/views.py
@@ -28,7 +28,8 @@ from external_auth.login_and_register import (
from lang_pref.api import released_languages, all_languages
from openedx.core.djangoapps.commerce.utils import ecommerce_api_client
from openedx.core.djangoapps.programs.models import ProgramsApiConfig
-from openedx.core.djangoapps.theming.helpers import is_request_in_themed_site, get_value as get_themed_value
+from openedx.core.djangoapps.theming.helpers import is_request_in_themed_site
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.user_api.accounts.api import request_password_change
from openedx.core.djangoapps.user_api.errors import UserNotFound
from openedx.core.lib.time_zone_utils import TIME_ZONE_CHOICES
@@ -75,9 +76,9 @@ def login_and_registration_form(request, initial_mode="login"):
# If this is a themed site, revert to the old login/registration pages.
# We need to do this for now to support existing themes.
# Themed sites can use the new logistration page by setting
- # 'ENABLE_COMBINED_LOGIN_REGISTRATION' in their theme/microsite
+ # 'ENABLE_COMBINED_LOGIN_REGISTRATION' in their
# configuration settings.
- if is_request_in_themed_site() and not get_themed_value('ENABLE_COMBINED_LOGIN_REGISTRATION', False):
+ if is_request_in_themed_site() and not configuration_helpers.get_value('ENABLE_COMBINED_LOGIN_REGISTRATION', False):
if initial_mode == "login":
return old_login_view(request)
elif initial_mode == "register":
@@ -108,7 +109,7 @@ def login_and_registration_form(request, initial_mode="login"):
'initial_mode': initial_mode,
'third_party_auth': _third_party_auth_context(request, redirect_to),
'third_party_auth_hint': third_party_auth_hint or '',
- 'platform_name': get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ 'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
# Include form descriptions retrieved from the user API.
# We could have the JS client make these requests directly,
@@ -122,7 +123,7 @@ def login_and_registration_form(request, initial_mode="login"):
'responsive': True,
'allow_iframing': True,
'disable_courseware_js': True,
- 'disable_footer': not get_themed_value(
+ 'disable_footer': not configuration_helpers.get_value(
'ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER',
settings.FEATURES['ENABLE_COMBINED_LOGIN_REGISTRATION_FOOTER']
),
@@ -456,7 +457,7 @@ def account_settings_context(request):
'options': TIME_ZONE_CHOICES,
}
},
- 'platform_name': get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ 'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
'user_accounts_api_url': reverse("accounts_api", kwargs={'username': user.username}),
'user_preferences_api_url': reverse('preferences_api', kwargs={'username': user.username}),
'disable_courseware_js': True,
diff --git a/lms/djangoapps/student_profile/views.py b/lms/djangoapps/student_profile/views.py
index 20fd4265f3..795a50ef06 100644
--- a/lms/djangoapps/student_profile/views.py
+++ b/lms/djangoapps/student_profile/views.py
@@ -11,11 +11,11 @@ from django.contrib.staticfiles.storage import staticfiles_storage
from badges.utils import badges_enabled
from edxmako.shortcuts import render_to_response, marketing_link
-from microsite_configuration import microsite
from openedx.core.djangoapps.user_api.accounts.api import get_account_settings
from openedx.core.djangoapps.user_api.errors import UserNotFound, UserNotAuthorized
from openedx.core.djangoapps.user_api.preferences.api import get_user_preferences
from student.models import User
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
@login_required
@@ -92,7 +92,7 @@ def learner_profile_context(request, profile_username, user_is_staff):
'badges_logo': staticfiles_storage.url('certificates/images/backpack-logo.png'),
'badges_icon': staticfiles_storage.url('certificates/images/ico-mozillaopenbadges.png'),
'backpack_ui_img': staticfiles_storage.url('certificates/images/backpack-ui.png'),
- 'platform_name': microsite.get_value('platform_name', settings.PLATFORM_NAME),
+ 'platform_name': configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME),
},
'disable_courseware_js': True,
}
diff --git a/lms/djangoapps/survey/views.py b/lms/djangoapps/survey/views.py
index 6eee188313..725bea8059 100644
--- a/lms/djangoapps/survey/views.py
+++ b/lms/djangoapps/survey/views.py
@@ -18,7 +18,7 @@ from opaque_keys.edx.keys import CourseKey
from edxmako.shortcuts import render_to_response
from survey.models import SurveyForm
-from microsite_configuration import microsite
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger("edx.survey")
@@ -51,7 +51,7 @@ def view_student_survey(user, survey_name, course=None, redirect_url=None, is_re
# just remove that outer key to make the JSON payload simplier
existing_answers = survey.get_answers(user=user).get(user.id, {})
- platform_name = microsite.get_value('platform_name', settings.PLATFORM_NAME)
+ platform_name = configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME)
context = {
'existing_data_json': json.dumps(existing_answers),
@@ -61,7 +61,7 @@ def view_student_survey(user, survey_name, course=None, redirect_url=None, is_re
'dashboard_redirect_url': dashboard_redirect_url,
'survey_form': survey.form,
'is_required': is_required,
- 'mail_to_link': microsite.get_value('email_from_address', settings.CONTACT_EMAIL),
+ 'mail_to_link': configuration_helpers.get_value('email_from_address', settings.CONTACT_EMAIL),
'platform_name': platform_name,
'course': course,
}
diff --git a/lms/djangoapps/verify_student/models.py b/lms/djangoapps/verify_student/models.py
index 8bff188b77..e4f1c144eb 100644
--- a/lms/djangoapps/verify_student/models.py
+++ b/lms/djangoapps/verify_student/models.py
@@ -45,8 +45,7 @@ from lms.djangoapps.verify_student.ssencrypt import (
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError
from xmodule_django.models import CourseKeyField
-
-from microsite_configuration.templatetags.microsite import platform_name
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger(__name__)
@@ -322,7 +321,9 @@ class PhotoVerification(StatusModel):
if attempt.created_at < cls._earliest_allowed_date():
return (
'expired',
- _("Your {platform_name} verification has expired.").format(platform_name=platform_name())
+ _("Your {platform_name} verification has expired.").format(
+ platform_name=configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME),
+ )
)
# If someone is denied their original verification attempt, they can try to reverify.
diff --git a/lms/djangoapps/verify_student/views.py b/lms/djangoapps/verify_student/views.py
index b5a0f355b3..16913613df 100644
--- a/lms/djangoapps/verify_student/views.py
+++ b/lms/djangoapps/verify_student/views.py
@@ -36,12 +36,12 @@ from courseware.url_helpers import get_redirect_url
from edx_rest_api_client.exceptions import SlumberBaseException
from edxmako.shortcuts import render_to_response, render_to_string
from embargo import api as embargo_api
-from microsite_configuration import microsite
from openedx.core.djangoapps.commerce.utils import ecommerce_api_client
from openedx.core.djangoapps.user_api.accounts import NAME_MIN_LENGTH
from openedx.core.djangoapps.user_api.accounts.api import update_account_settings
from openedx.core.djangoapps.user_api.errors import UserNotFound, AccountValidationError
from openedx.core.djangoapps.credit.api import set_credit_requirement_status
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from student.models import CourseEnrollment
from shoppingcart.models import Order, CertificateItem
from shoppingcart.processors import (
@@ -61,7 +61,6 @@ from util.date_utils import get_default_time_display
from util.db import outer_atomic
from xmodule.modulestore.django import modulestore
from django.contrib.staticfiles.storage import staticfiles_storage
-from openedx.core.djangoapps.theming import helpers as theming_helpers
log = logging.getLogger(__name__)
@@ -420,7 +419,7 @@ class PayAndVerifyView(View):
'is_active': json.dumps(request.user.is_active),
'user_email': request.user.email,
'message_key': message,
- 'platform_name': theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ 'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
'processors': processors,
'requirements': requirements,
'user_full_name': full_name,
@@ -1101,12 +1100,12 @@ class SubmitPhotosView(View):
"""
context = {
'full_name': user.profile.name,
- 'platform_name': microsite.get_value("PLATFORM_NAME", settings.PLATFORM_NAME)
+ 'platform_name': configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME)
}
subject = _("Verification photos received")
message = render_to_string('emails/photo_submission_confirmation.txt', context)
- from_address = theming_helpers.get_value('default_from_email', settings.DEFAULT_FROM_EMAIL)
+ from_address = configuration_helpers.get_value('default_from_email', settings.DEFAULT_FROM_EMAIL)
to_address = user.email
try:
@@ -1185,10 +1184,10 @@ def _compose_message_reverification_email(
context["verification_open"] = verification_open
context["due_date"] = get_default_time_display(reverification_block.due)
- context['platform_name'] = theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
+ context['platform_name'] = configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
context["used_attempts"] = used_attempts
context["allowed_attempts"] = allowed_attempts
- context["support_link"] = microsite.get_value('email_from_address', settings.CONTACT_EMAIL)
+ context["support_link"] = configuration_helpers.get_value('email_from_address', settings.CONTACT_EMAIL)
re_verification_link = reverse(
'verify_student_incourse_reverify',
@@ -1225,7 +1224,7 @@ def _send_email(user_id, subject, message):
Returns:
None
"""
- from_address = theming_helpers.get_value(
+ from_address = configuration_helpers.get_value(
'email_from_address',
settings.DEFAULT_FROM_EMAIL
)
@@ -1385,7 +1384,7 @@ class ReverifyView(View):
if status in ["none", "must_reverify", "expired", "pending"]:
context = {
"user_full_name": request.user.profile.name,
- "platform_name": theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ "platform_name": configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
"capture_sound": staticfiles_storage.url("audio/camera_capture.wav"),
}
return render_to_response("verify_student/reverify.html", context)
@@ -1450,7 +1449,7 @@ class InCourseReverifyView(View):
'course_key': unicode(course_key),
'course_name': course.display_name_with_default_escaped,
'checkpoint_name': checkpoint.checkpoint_name,
- 'platform_name': theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ 'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
'usage_id': usage_id,
'capture_sound': staticfiles_storage.url("audio/camera_capture.wav"),
}
diff --git a/lms/envs/common.py b/lms/envs/common.py
index 7f853c298b..bdef305949 100644
--- a/lms/envs/common.py
+++ b/lms/envs/common.py
@@ -492,7 +492,6 @@ TEMPLATES = [
'django.template.context_processors.i18n',
'django.contrib.auth.context_processors.auth', # this is required for admin
'django.template.context_processors.csrf',
- 'microsite_configuration.context_processors.microsite_context',
# Added for django-wiki
'django.template.context_processors.media',
@@ -507,10 +506,11 @@ TEMPLATES = [
'shoppingcart.context_processor.user_has_cart_context_processor',
# Allows the open edX footer to be leveraged in Django Templates.
- 'edxmako.shortcuts.microsite_footer_context_processor',
+ 'edxmako.shortcuts.footer_context_processor',
# Online contextual help
'context_processors.doc_url',
+ 'openedx.core.djangoapps.site_configuration.context_processors.configuration_context'
],
# Change 'debug' in your environment settings files - not here.
'debug': False
diff --git a/lms/envs/test.py b/lms/envs/test.py
index 0b73ce4cef..ec1ec1b35c 100644
--- a/lms/envs/test.py
+++ b/lms/envs/test.py
@@ -423,56 +423,56 @@ SITE_NAME = "edx.org"
# set up some testing for microsites
FEATURES['USE_MICROSITES'] = True
-MICROSITE_ROOT_DIR = COMMON_ROOT / 'test' / 'test_microsites'
+MICROSITE_ROOT_DIR = COMMON_ROOT / 'test' / 'test_sites'
MICROSITE_CONFIGURATION = {
- "test_microsite": {
- "domain_prefix": "testmicrosite",
- "university": "test_microsite",
- "platform_name": "Test Microsite",
- "logo_image_url": "test_microsite/images/header-logo.png",
- "email_from_address": "test_microsite@edx.org",
- "payment_support_email": "test_microsite@edx.org",
+ "test_site": {
+ "domain_prefix": "test-site",
+ "university": "test_site",
+ "platform_name": "Test Site",
+ "logo_image_url": "test_site/images/header-logo.png",
+ "email_from_address": "test_site@edx.org",
+ "payment_support_email": "test_site@edx.org",
"ENABLE_MKTG_SITE": False,
- "SITE_NAME": "test_microsite.localhost",
- "course_org_filter": "TestMicrositeX",
+ "SITE_NAME": "test_site.localhost",
+ "course_org_filter": "TestSiteX",
"course_about_show_social_links": False,
- "css_overrides_file": "test_microsite/css/test_microsite.css",
+ "css_overrides_file": "test_site/css/test_site.css",
"show_partners": False,
"show_homepage_promo_video": False,
- "course_index_overlay_text": "This is a Test Microsite Overlay Text.",
- "course_index_overlay_logo_file": "test_microsite/images/header-logo.png",
- "homepage_overlay_html": "This is a Test Microsite Overlay HTML ",
+ "course_index_overlay_text": "This is a Test Site Overlay Text.",
+ "course_index_overlay_logo_file": "test_site/images/header-logo.png",
+ "homepage_overlay_html": "This is a Test Site Overlay HTML ",
"ALWAYS_REDIRECT_HOMEPAGE_TO_DASHBOARD_FOR_AUTHENTICATED_USER": False,
"COURSE_CATALOG_VISIBILITY_PERMISSION": "see_in_catalog",
"COURSE_ABOUT_VISIBILITY_PERMISSION": "see_about_page",
"ENABLE_SHOPPING_CART": True,
"ENABLE_PAID_COURSE_REGISTRATION": True,
- "SESSION_COOKIE_DOMAIN": "test_microsite.localhost",
+ "SESSION_COOKIE_DOMAIN": "test_site.localhost",
"LINKEDIN_COMPANY_ID": "test",
"FACEBOOK_APP_ID": "12345678908",
"urls": {
- 'ABOUT': 'testmicrosite/about',
- 'PRIVACY': 'testmicrosite/privacy',
- 'TOS_AND_HONOR': 'testmicrosite/tos-and-honor',
+ 'ABOUT': 'test-site/about',
+ 'PRIVACY': 'test-site/privacy',
+ 'TOS_AND_HONOR': 'test-site/tos-and-honor',
},
},
- "microsite_with_logistration": {
+ "site_with_logistration": {
"domain_prefix": "logistration",
"university": "logistration",
"platform_name": "Test logistration",
- "logo_image_url": "test_microsite/images/header-logo.png",
- "email_from_address": "test_microsite@edx.org",
- "payment_support_email": "test_microsite@edx.org",
+ "logo_image_url": "test_site/images/header-logo.png",
+ "email_from_address": "test_site@edx.org",
+ "payment_support_email": "test_site@edx.org",
"ENABLE_MKTG_SITE": False,
"ENABLE_COMBINED_LOGIN_REGISTRATION": True,
- "SITE_NAME": "test_microsite.localhost",
+ "SITE_NAME": "test_site.localhost",
"course_org_filter": "LogistrationX",
"course_about_show_social_links": False,
- "css_overrides_file": "test_microsite/css/test_microsite.css",
+ "css_overrides_file": "test_site/css/test_site.css",
"show_partners": False,
"show_homepage_promo_video": False,
"course_index_overlay_text": "Logistration.",
- "course_index_overlay_logo_file": "test_microsite/images/header-logo.png",
+ "course_index_overlay_logo_file": "test_site/images/header-logo.png",
"homepage_overlay_html": "This is a Logistration HTML ",
"ALWAYS_REDIRECT_HOMEPAGE_TO_DASHBOARD_FOR_AUTHENTICATED_USER": False,
"COURSE_CATALOG_VISIBILITY_PERMISSION": "see_in_catalog",
@@ -487,7 +487,7 @@ MICROSITE_CONFIGURATION = {
}
}
-MICROSITE_TEST_HOSTNAME = 'testmicrosite.testserver'
+MICROSITE_TEST_HOSTNAME = 'test-site.testserver'
MICROSITE_LOGISTRATION_HOSTNAME = 'logistration.testserver'
TEST_THEME = COMMON_ROOT / "test" / "test-theme"
@@ -495,7 +495,7 @@ TEST_THEME = COMMON_ROOT / "test" / "test-theme"
# add extra template directory for test-only templates
MAKO_TEMPLATES['main'].extend([
COMMON_ROOT / 'test' / 'templates',
- COMMON_ROOT / 'test' / 'test_microsites',
+ COMMON_ROOT / 'test' / 'test_sites',
REPO_ROOT / 'openedx' / 'core' / 'djangolib' / 'tests' / 'templates',
])
diff --git a/lms/lib/courseware_search/lms_filter_generator.py b/lms/lib/courseware_search/lms_filter_generator.py
index bee00302a1..50503e26cd 100644
--- a/lms/lib/courseware_search/lms_filter_generator.py
+++ b/lms/lib/courseware_search/lms_filter_generator.py
@@ -2,13 +2,12 @@
This file contains implementation override of SearchFilterGenerator which will allow
* Filter by all courses in which the user is enrolled in
"""
-from microsite_configuration import microsite
from student.models import CourseEnrollment
from search.filter_generator import SearchFilterGenerator
from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme
from openedx.core.djangoapps.course_groups.partition_scheme import CohortPartitionScheme
-
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
INCLUDE_SCHEMES = [CohortPartitionScheme, RandomUserPartitionScheme, ]
SCHEME_SUPPORTS_ASSIGNMENT = [RandomUserPartitionScheme, ]
@@ -35,19 +34,21 @@ class LmsSearchFilterGenerator(SearchFilterGenerator):
field_dictionary['course'] = [unicode(enrollment.course_id) for enrollment in user_enrollments]
# if we have an org filter, only include results for this org filter
- course_org_filter = microsite.get_value('course_org_filter')
+ course_org_filter = configuration_helpers.get_value('course_org_filter')
if course_org_filter:
field_dictionary['org'] = course_org_filter
return field_dictionary
def exclude_dictionary(self, **kwargs):
- """ If we are not on a microsite, then exclude any microsites that are defined """
+ """
+ Exclude any courses defined outside the current org.
+ """
exclude_dictionary = super(LmsSearchFilterGenerator, self).exclude_dictionary(**kwargs)
- course_org_filter = microsite.get_value('course_org_filter')
+ course_org_filter = configuration_helpers.get_value('course_org_filter')
# If we have a course filter we are ensuring that we only get those courses above
if not course_org_filter:
- org_filter_out_set = microsite.get_all_orgs()
+ org_filter_out_set = configuration_helpers.get_all_orgs()
if org_filter_out_set:
exclude_dictionary['org'] = list(org_filter_out_set)
diff --git a/lms/lib/courseware_search/test/test_lms_filter_generator.py b/lms/lib/courseware_search/test/test_lms_filter_generator.py
index e56bff22b2..b51b2df8cc 100644
--- a/lms/lib/courseware_search/test/test_lms_filter_generator.py
+++ b/lms/lib/courseware_search/test/test_lms_filter_generator.py
@@ -11,7 +11,7 @@ from lms.lib.courseware_search.lms_filter_generator import LmsSearchFilterGenera
class LmsSearchFilterGeneratorTestCase(ModuleStoreTestCase):
- """ Test case class to test search result processor """
+ """ Tests for search result processor """
def build_courses(self):
"""
@@ -87,52 +87,51 @@ class LmsSearchFilterGeneratorTestCase(ModuleStoreTestCase):
self.assertTrue('start_date' in filter_dictionary)
self.assertEqual(0, len(field_dictionary['course']))
- def test_excludes_microsite(self):
+ def test_excludes_site_org(self):
"""
- By default there is the test microsite and the microsite with logistration
- to exclude
+ By default site orgs not belonging to current site org should be excluded.
"""
_, _, exclude_dictionary = LmsSearchFilterGenerator.generate_field_filters(user=self.user)
self.assertIn('org', exclude_dictionary)
exclude_orgs = exclude_dictionary['org']
self.assertEqual(2, len(exclude_orgs))
self.assertEqual('LogistrationX', exclude_orgs[0])
- self.assertEqual('TestMicrositeX', exclude_orgs[1])
+ self.assertEqual('TestSiteX', exclude_orgs[1])
- @patch('microsite_configuration.microsite.get_all_orgs', Mock(return_value=[]))
- def test_excludes_no_microsite(self):
- """ Test when no microsite is present - nothing to exclude """
+ @patch('openedx.core.djangoapps.site_configuration.helpers.get_all_orgs', Mock(return_value=[]))
+ def test_no_excludes_with_no_orgs(self):
+ """ Test when no org is present - nothing to exclude """
_, _, exclude_dictionary = LmsSearchFilterGenerator.generate_field_filters(user=self.user)
self.assertNotIn('org', exclude_dictionary)
- @patch('microsite_configuration.microsite.get_value', Mock(return_value='TestMicrositeX'))
- def test_excludes_microsite_within(self):
+ @patch('openedx.core.djangoapps.site_configuration.helpers.get_value', Mock(return_value='TestSiteX'))
+ def test_excludes_org_within(self):
field_dictionary, _, exclude_dictionary = LmsSearchFilterGenerator.generate_field_filters(user=self.user)
self.assertNotIn('org', exclude_dictionary)
self.assertIn('org', field_dictionary)
- self.assertEqual('TestMicrositeX', field_dictionary['org'])
+ self.assertEqual('TestSiteX', field_dictionary['org'])
@patch(
- 'microsite_configuration.microsite.get_all_orgs',
- Mock(return_value=["TestMicrosite1", "TestMicrosite2", "TestMicrosite3", "TestMicrosite4"])
+ 'openedx.core.djangoapps.site_configuration.helpers.get_all_orgs',
+ Mock(return_value=["TestSite1", "TestSite2", "TestSite3", "TestSite4"])
)
- def test_excludes_multi_microsites(self):
+ def test_excludes_multi_orgs(self):
_, _, exclude_dictionary = LmsSearchFilterGenerator.generate_field_filters(user=self.user)
self.assertIn('org', exclude_dictionary)
exclude_orgs = exclude_dictionary['org']
self.assertEqual(4, len(exclude_orgs))
- self.assertIn('TestMicrosite1', exclude_orgs)
- self.assertIn('TestMicrosite2', exclude_orgs)
- self.assertIn('TestMicrosite3', exclude_orgs)
- self.assertIn('TestMicrosite4', exclude_orgs)
+ self.assertIn('TestSite1', exclude_orgs)
+ self.assertIn('TestSite2', exclude_orgs)
+ self.assertIn('TestSite3', exclude_orgs)
+ self.assertIn('TestSite4', exclude_orgs)
@patch(
- 'microsite_configuration.microsite.get_all_orgs',
- Mock(return_value=["TestMicrosite1", "TestMicrosite2", "TestMicrosite3", "TestMicrosite4"])
+ 'openedx.core.djangoapps.site_configuration.helpers.get_all_orgs',
+ Mock(return_value=["TestSite1", "TestSite2", "TestSite3", "TestSite4"])
)
- @patch('microsite_configuration.microsite.get_value', Mock(return_value='TestMicrosite3'))
- def test_excludes_multi_microsites_within(self):
+ @patch('openedx.core.djangoapps.site_configuration.helpers.get_value', Mock(return_value='TestSite3'))
+ def test_excludes_multi_orgs_within(self):
field_dictionary, _, exclude_dictionary = LmsSearchFilterGenerator.generate_field_filters(user=self.user)
self.assertNotIn('org', exclude_dictionary)
self.assertIn('org', field_dictionary)
- self.assertEqual('TestMicrosite3', field_dictionary['org'])
+ self.assertEqual('TestSite3', field_dictionary['org'])
diff --git a/lms/templates/emails/activation_email.txt b/lms/templates/emails/activation_email.txt
index f1231f5fff..66670f9d47 100644
--- a/lms/templates/emails/activation_email.txt
+++ b/lms/templates/emails/activation_email.txt
@@ -1,14 +1,14 @@
<%! from django.utils.translation import ugettext as _ %>
-<%! from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value %>
+<%! from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers %>
${_("Thank you for creating an account with {platform_name}!").format(
- platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)
+ platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
)}
${_("There's just one more step before you can enroll in a course: "
"you need to activate your {platform_name} account. To activate "
"your account, click the following link. If that doesn't work, "
"copy and paste the link into your browser's address bar.").format(
- platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)
+ platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
)}
% if is_secure:
@@ -19,4 +19,4 @@ ${_("There's just one more step before you can enroll in a course: "
${_("If you didn't create an account, you don't need to do anything; you "
"won't receive any more email from us. If you need assistance, please "
"do not reply to this email message. Check the help section of the "
- "{platform_name} website.").format(platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME))}
+ "{platform_name} website.").format(platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME))}
diff --git a/lms/templates/emails/activation_email_subject.txt b/lms/templates/emails/activation_email_subject.txt
index 8fb64f9abc..a83900a7c1 100644
--- a/lms/templates/emails/activation_email_subject.txt
+++ b/lms/templates/emails/activation_email_subject.txt
@@ -1,6 +1,6 @@
<%! from django.utils.translation import ugettext as _ %>
-<%! from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value %>
+<%! from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers %>
${_("Activate Your {platform_name} Account").format(
- platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME
+ platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME
))}
diff --git a/lms/templates/emails/confirm_email_change.txt b/lms/templates/emails/confirm_email_change.txt
index b462d78e37..45a7a8195e 100644
--- a/lms/templates/emails/confirm_email_change.txt
+++ b/lms/templates/emails/confirm_email_change.txt
@@ -1,11 +1,11 @@
<%! from django.core.urlresolvers import reverse %>
<%! from django.utils.translation import ugettext as _ %>
-<%! from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value %>
+<%! from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers %>
${_("This is to confirm that you changed the e-mail associated with "
"{platform_name} from {old_email} to {new_email}. If you "
"did not make this request, please contact us immediately. Contact "
"information is listed at:").format(
- platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
old_email=old_email,
new_email=new_email
)
diff --git a/lms/templates/emails/email_change.txt b/lms/templates/emails/email_change.txt
index 618320fb49..a025d2dbf0 100644
--- a/lms/templates/emails/email_change.txt
+++ b/lms/templates/emails/email_change.txt
@@ -1,10 +1,10 @@
<%! from django.utils.translation import ugettext as _ %>
-<%! from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value %>
+<%! from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers %>
${_("We received a request to change the e-mail associated with your "
"{platform_name} account from {old_email} to {new_email}. "
"If this is correct, please confirm your new e-mail address by "
"visiting:").format(
- platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
old_email=old_email,
new_email=new_email
)
@@ -19,4 +19,4 @@ ${_("We received a request to change the e-mail associated with your "
${_("If you didn't request this, you don't need to do anything; you won't "
"receive any more email from us. Please do not reply to this e-mail; "
"if you require assistance, check the help section of the "
- "{platform_name} web site.").format(platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME))}
+ "{platform_name} web site.").format(platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME))}
diff --git a/lms/templates/emails/email_change_subject.txt b/lms/templates/emails/email_change_subject.txt
index acc114bb98..11c27e52de 100644
--- a/lms/templates/emails/email_change_subject.txt
+++ b/lms/templates/emails/email_change_subject.txt
@@ -1,5 +1,5 @@
<%! from django.utils.translation import ugettext as _ %>
-<%! from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value %>
+<%! from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers %>
${_("Request to change {platform_name} account e-mail").format(
- platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)
+ platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
)}
diff --git a/lms/templates/main_django.html b/lms/templates/main_django.html
index 0d24d3c879..c0da1be1d1 100644
--- a/lms/templates/main_django.html
+++ b/lms/templates/main_django.html
@@ -1,5 +1,5 @@
-{% load sekizai_tags i18n microsite theme_pipeline optional_include staticfiles %}
+{% load sekizai_tags i18n configuration theme_pipeline optional_include staticfiles %}
{% load url from future %}
diff --git a/lms/templates/navigation.html b/lms/templates/navigation.html
index 8521627c28..b1fb56d90d 100644
--- a/lms/templates/navigation.html
+++ b/lms/templates/navigation.html
@@ -8,8 +8,6 @@ from django.utils.translation import ugettext as _
from context_processors import doc_url
from lms.djangoapps.ccx.overrides import get_current_ccx
-from microsite_configuration import microsite
-from microsite_configuration.templatetags.microsite import platform_name
from openedx.core.djangolib.markup import HTML, Text
# App that handles subdomain specific branding
diff --git a/lms/templates/wiki/base.html b/lms/templates/wiki/base.html
index 78d3cf4a92..c2f8aa367d 100644
--- a/lms/templates/wiki/base.html
+++ b/lms/templates/wiki/base.html
@@ -1,6 +1,6 @@
{% extends "main_django.html" %}
{% with online_help_token="wiki" %}
-{% load theme_pipeline %}{% load sekizai_tags i18n microsite %}{% load url from future %}{% load staticfiles %}
+{% load theme_pipeline %}{% load sekizai_tags i18n configuration %}{% load url from future %}{% load staticfiles %}
{% block title %}
{% block pagetitle %}{% endblock %} | {% trans "Wiki" %} | {% platform_name %}
diff --git a/lms/urls.py b/lms/urls.py
index d197b64d7d..c4558f69c6 100644
--- a/lms/urls.py
+++ b/lms/urls.py
@@ -8,7 +8,6 @@ from django.views.generic.base import RedirectView
from ratelimitbackend import admin
from django.conf.urls.static import static
-from microsite_configuration import microsite
import auth_exchange.views
from courseware.views.views import EnrollStaffView
from config_models.views import ConfigurationModelCurrentAPIView
@@ -16,6 +15,7 @@ from courseware.views.index import CoursewareIndex
from openedx.core.djangoapps.catalog.models import CatalogIntegration
from openedx.core.djangoapps.programs.models import ProgramsApiConfig
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from student.views import LogoutView
# Uncomment the next two lines to enable the admin:
@@ -170,7 +170,7 @@ urlpatterns += (
)
# Favicon
-favicon_path = microsite.get_value('favicon_path', settings.FAVICON_PATH)
+favicon_path = configuration_helpers.get_value('favicon_path', settings.FAVICON_PATH) # pylint: disable=invalid-name
urlpatterns += (url(
r'^favicon\.ico$',
RedirectView.as_view(url=settings.STATIC_URL + favicon_path, permanent=True)
diff --git a/openedx/core/djangoapps/api_admin/models.py b/openedx/core/djangoapps/api_admin/models.py
index 57c16338d4..d8963cac2a 100644
--- a/openedx/core/djangoapps/api_admin/models.py
+++ b/openedx/core/djangoapps/api_admin/models.py
@@ -17,7 +17,7 @@ from edxmako.shortcuts import render_to_string
from simple_history.models import HistoricalRecords
from config_models.models import ConfigurationModel
-from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger(__name__)
@@ -162,7 +162,7 @@ def _send_decision_email(instance):
'authentication_docs_url': settings.AUTH_DOCUMENTATION_URL,
'api_docs_url': settings.API_DOCUMENTATION_URL,
'support_email_address': settings.API_ACCESS_FROM_EMAIL,
- 'platform_name': get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)
+ 'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
}
message = render_to_string(
diff --git a/openedx/core/djangoapps/api_admin/widgets.py b/openedx/core/djangoapps/api_admin/widgets.py
index f51800f09b..4430e3c0a6 100644
--- a/openedx/core/djangoapps/api_admin/widgets.py
+++ b/openedx/core/djangoapps/api_admin/widgets.py
@@ -7,7 +7,7 @@ from django.forms.widgets import CheckboxInput
from django.utils.encoding import force_text
from django.utils.html import format_html
from django.utils.translation import ugettext as _
-from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
class TermsOfServiceCheckboxInput(CheckboxInput):
@@ -24,7 +24,7 @@ class TermsOfServiceCheckboxInput(CheckboxInput):
# Translators: link_start and link_end are HTML tags for a link to the terms of service.
# platform_name is the name of this Open edX installation.
label = _('I, and my company, accept the {link_start}{platform_name} API Terms of Service{link_end}.').format(
- platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
link_start=''.format(url=reverse('api_admin:api-tos')),
link_end=' ',
)
diff --git a/openedx/core/djangoapps/commerce/utils.py b/openedx/core/djangoapps/commerce/utils.py
index 081d2b6cb4..07175a534d 100644
--- a/openedx/core/djangoapps/commerce/utils.py
+++ b/openedx/core/djangoapps/commerce/utils.py
@@ -3,7 +3,7 @@ from django.conf import settings
from edx_rest_api_client.client import EdxRestApiClient
from eventtracking import tracker
-from openedx.core.djangoapps.theming import helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
ECOMMERCE_DATE_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
@@ -25,17 +25,19 @@ def is_commerce_service_configured():
Return a Boolean indicating whether or not configuration is present to use
the external commerce service.
"""
- ecommerce_api_url = helpers.get_value("ECOMMERCE_API_URL", settings.ECOMMERCE_API_URL)
- ecommerce_api_signing_key = helpers.get_value("ECOMMERCE_API_SIGNING_KEY", settings.ECOMMERCE_API_SIGNING_KEY)
+ ecommerce_api_url = configuration_helpers.get_value("ECOMMERCE_API_URL", settings.ECOMMERCE_API_URL)
+ ecommerce_api_signing_key = configuration_helpers.get_value(
+ "ECOMMERCE_API_SIGNING_KEY", settings.ECOMMERCE_API_SIGNING_KEY,
+ )
return bool(ecommerce_api_url and ecommerce_api_signing_key)
def ecommerce_api_client(user):
""" Returns an E-Commerce API client setup with authentication for the specified user. """
- jwt_auth = helpers.get_value("JWT_AUTH", settings.JWT_AUTH)
+ jwt_auth = configuration_helpers.get_value("JWT_AUTH", settings.JWT_AUTH)
return EdxRestApiClient(
- helpers.get_value("ECOMMERCE_API_URL", settings.ECOMMERCE_API_URL),
- helpers.get_value("ECOMMERCE_API_SIGNING_KEY", settings.ECOMMERCE_API_SIGNING_KEY),
+ configuration_helpers.get_value("ECOMMERCE_API_URL", settings.ECOMMERCE_API_URL),
+ configuration_helpers.get_value("ECOMMERCE_API_SIGNING_KEY", settings.ECOMMERCE_API_SIGNING_KEY),
user.username,
user.profile.name if hasattr(user, 'profile') else None,
user.email,
diff --git a/openedx/core/djangoapps/credit/email_utils.py b/openedx/core/djangoapps/credit/email_utils.py
index 2a33ab9156..f837c739e2 100644
--- a/openedx/core/djangoapps/credit/email_utils.py
+++ b/openedx/core/djangoapps/credit/email_utils.py
@@ -23,11 +23,10 @@ from email.mime.multipart import MIMEMultipart
from eventtracking import tracker
from edxmako.shortcuts import render_to_string
from edxmako.template import Template
-from microsite_configuration import microsite
from openedx.core.djangoapps.commerce.utils import ecommerce_api_client
from openedx.core.djangoapps.credit.models import CreditConfig, CreditProvider
from xmodule.modulestore.django import modulestore
-from openedx.core.djangoapps.theming import helpers as theming_helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
log = logging.getLogger(__name__)
@@ -73,7 +72,7 @@ def send_credit_notifications(username, course_key):
providers_string = make_providers_strings(providers_names)
context = {
'full_name': user.get_full_name(),
- 'platform_name': theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
+ 'platform_name': configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
'course_name': course_display_name,
'branded_logo': logo_image_id,
'dashboard_link': dashboard_link,
@@ -125,7 +124,7 @@ def send_credit_notifications(username, course_key):
notification_msg.attach(logo_image)
# add email addresses of sender and receiver
- from_address = theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
+ from_address = configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL)
to_address = user.email
# send the root email message
@@ -186,7 +185,7 @@ def _email_url_parser(url_name, extra_param=None):
Returns:
str
"""
- site_name = microsite.get_value('SITE_NAME', settings.SITE_NAME)
+ site_name = configuration_helpers.get_value('SITE_NAME', settings.SITE_NAME)
dashboard_url_path = reverse(url_name) + extra_param if extra_param else reverse(url_name)
dashboard_link_parts = ("https", site_name, dashboard_url_path, '', '', '')
return urlparse.urlunparse(dashboard_link_parts)
diff --git a/openedx/core/djangoapps/site_configuration/admin.py b/openedx/core/djangoapps/site_configuration/admin.py
new file mode 100644
index 0000000000..956a3ec034
--- /dev/null
+++ b/openedx/core/djangoapps/site_configuration/admin.py
@@ -0,0 +1,52 @@
+"""
+Django admin page for Site Configuration models
+"""
+from django.contrib import admin
+
+from .models import (
+ SiteConfiguration,
+ SiteConfigurationHistory,
+)
+
+
+class SiteConfigurationAdmin(admin.ModelAdmin):
+ """
+ Admin interface for the SiteConfiguration object.
+ """
+ list_display = ('site', 'enabled', 'values')
+ search_fields = ('site__domain', 'values')
+
+ class Meta(object):
+ """
+ Meta class for SiteConfiguration admin model
+ """
+ model = SiteConfiguration
+
+admin.site.register(SiteConfiguration, SiteConfigurationAdmin)
+
+
+class SiteConfigurationHistoryAdmin(admin.ModelAdmin):
+ """
+ Admin interface for the SiteConfigurationHistory object.
+ """
+ list_display = ('site', 'enabled', 'created', 'modified')
+ search_fields = ('site__domain', 'values', 'created', 'modified')
+
+ ordering = ['-created']
+
+ class Meta(object):
+ """
+ Meta class for SiteConfigurationHistory admin model
+ """
+ model = SiteConfigurationHistory
+
+ def has_add_permission(self, request):
+ """Don't allow adds"""
+ return False
+
+ def has_delete_permission(self, request, obj=None):
+ """Don't allow deletes"""
+ return False
+
+
+admin.site.register(SiteConfigurationHistory, SiteConfigurationHistoryAdmin)
diff --git a/openedx/core/djangoapps/site_configuration/context_processors.py b/openedx/core/djangoapps/site_configuration/context_processors.py
new file mode 100644
index 0000000000..801d98b8f7
--- /dev/null
+++ b/openedx/core/djangoapps/site_configuration/context_processors.py
@@ -0,0 +1,16 @@
+"""
+Django template context processors.
+"""
+
+from django.conf import settings
+
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
+
+
+def configuration_context(request): # pylint: disable=unused-argument
+ """
+ Configuration context for django templates.
+ """
+ return {
+ 'platform_name': configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME)
+ }
diff --git a/openedx/core/djangoapps/site_configuration/helpers.py b/openedx/core/djangoapps/site_configuration/helpers.py
new file mode 100644
index 0000000000..8671793cbd
--- /dev/null
+++ b/openedx/core/djangoapps/site_configuration/helpers.py
@@ -0,0 +1,215 @@
+"""
+Helpers methods for site configuration.
+"""
+from django.conf import settings
+from openedx.core.djangoapps.site_configuration.models import SiteConfiguration
+from microsite_configuration import microsite
+
+
+def get_current_site_configuration():
+ """
+ Return configuration for the current site.
+
+ Returns:
+ (openedx.core.djangoapps.site_configuration.models.SiteConfiguration): SiteConfiguration instance associated
+ with the current site.
+ """
+
+ # Import is placed here to avoid circular import
+ from openedx.core.djangoapps.theming.helpers import get_current_site
+ site = get_current_site()
+
+ try:
+ return getattr(site, "configuration", None)
+ except SiteConfiguration.DoesNotExist:
+ return None
+
+
+def is_site_configuration_enabled():
+ """
+ Returns True is there is SiteConfiguration instance associated with the current site and it is enabled, otherwise
+ returns False.
+
+ Returns:
+ (bool): True if SiteConfiguration is present and enabled, False otherwise
+ """
+ configuration = get_current_site_configuration()
+ if configuration:
+ return configuration.enabled
+ return False
+
+
+def has_configuration_override(name):
+ """
+ Returns True/False whether a Site Configuration has a definition for the
+ specified key.
+
+ Args:
+ name (str): Name of the configuration dict to retrieve.
+
+ Returns:
+ (bool): True if given key is present in the configuration.
+ """
+ configuration = get_current_site_configuration()
+ if configuration and name in configuration.values:
+ return True
+ return False
+
+
+def get_configuration_value(name, default=None):
+ """
+ Return Configuration value for the key specified as name argument.
+
+ Args:
+ name (str): Name of the key for which to return configuration value.
+ default: default value tp return if key is not found in the configuration
+
+ Returns:
+ Configuration value for the given key or returns `None` if configuration is not enabled.
+ """
+ configuration = get_current_site_configuration()
+ return configuration.get_value(name, default)
+
+
+def get_configuration_dict(name, default=None):
+ """
+ Returns a dictionary product after merging the current site's configuration and
+ the default value.
+
+ Args:
+ name (str): Name of the configuration dict to retrieve.
+ default (dict): default dict containing key-value pairs of default values.
+
+ Returns:
+ Configuration value for the given key or returns `{}` if configuration is not enabled.
+ """
+
+ default = default or {}
+ output = default.copy()
+ output.update(
+ get_configuration_value(name, {}) or {},
+ )
+
+ return output
+
+
+def get_value(val_name, default=None, **kwargs):
+ """
+ Return configuration value for the key specified as name argument.
+
+ Args:
+ val_name (str): Name of the key for which to return configuration value.
+ default: default value tp return if key is not found in the configuration
+
+ Returns:
+ Configuration/Microsite value for the given key.
+ """
+
+ if is_site_configuration_enabled():
+ # Retrieve the requested field/value from the site configuration
+ configuration_value = get_configuration_value(val_name, default=default)
+ else:
+ # Retrieve the requested field/value from the microsite configuration
+ configuration_value = microsite.get_value(val_name, default=default, **kwargs)
+
+ # Attempt to perform a dictionary update using the provided default
+ # This will fail if either the default or the microsite value is not a dictionary
+ try:
+ value = dict(default)
+ value.update(configuration_value)
+
+ # If the dictionary update fails, just use the microsite value
+ # TypeError: default is not iterable (simple value or None)
+ # ValueError: default is iterable but not a dict (list, not dict)
+ # AttributeError: default does not have an 'update' method
+ except (TypeError, ValueError, AttributeError):
+ value = configuration_value
+
+ # Return the end result to the caller
+ return value
+
+
+def get_dict(name, default=None):
+ """
+ Returns a dictionary product after merging configuration and
+ the default value.
+
+ Args:
+ name (str): Name of the configuration dict to retrieve.
+ default (dict): default dict containing key-value pairs of default values.
+
+ Returns:
+ Configuration value for the given key or returns `{}` if configuration not found.
+ """
+ default = default or {}
+
+ if is_site_configuration_enabled():
+ return get_configuration_dict(name, default)
+ else:
+ return microsite.get_dict(name, default)
+
+
+def has_override_value(name):
+ """
+ Returns True/False whether configuration has a definition for the
+ specified key.
+
+ Args:
+ name (str): Name of the configuration dict to retrieve.
+
+ Returns:
+ (bool): True if given key is present in the configuration.
+ """
+ if is_site_configuration_enabled():
+ return has_configuration_override(name)
+ else:
+ return microsite.has_override_value(name)
+
+
+def get_value_for_org(org, val_name, default=None):
+ """
+ This returns a configuration value for a site configuration which has an org_filter that matches
+ what is passed in.
+
+ Args:
+ org (str): Course ord filter, this value will be used to filter out the correct site configuration.
+ name (str): Name of the key for which to return configuration value.
+ default: default value tp return if key is not found in the configuration
+
+ Returns:
+ Configuration value for the given key.
+
+ """
+ if is_site_configuration_enabled():
+ return SiteConfiguration.get_value_for_org(org, val_name, default)
+ else:
+ return microsite.get_value_for_org(org, val_name, default)
+
+
+def get_all_orgs():
+ """
+ This returns all of the orgs that are considered in site configurations, This can be used,
+ for example, to do filtering.
+
+ Returns:
+ Configuration value for the given key.
+ """
+ if is_site_configuration_enabled():
+ return SiteConfiguration.get_all_orgs()
+ else:
+ return microsite.get_all_orgs()
+
+
+def page_title_breadcrumbs(*crumbs, **kwargs):
+ """
+ This function creates a suitable page title in the form:
+ Specific | Less Specific | General | edX
+ It will output the correct platform name for the request.
+ Pass in a `separator` kwarg to override the default of " | "
+ """
+ platform_name = get_value('platform_name', settings.PLATFORM_NAME)
+ separator = kwargs.get("separator", " | ")
+ if crumbs:
+ return u'{}{}{}'.format(separator.join(crumbs), separator, platform_name)
+ else:
+ return platform_name
diff --git a/openedx/core/djangoapps/site_configuration/migrations/0002_auto_20160720_0231.py b/openedx/core/djangoapps/site_configuration/migrations/0002_auto_20160720_0231.py
new file mode 100644
index 0000000000..0548a00942
--- /dev/null
+++ b/openedx/core/djangoapps/site_configuration/migrations/0002_auto_20160720_0231.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('site_configuration', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='siteconfiguration',
+ name='enabled',
+ field=models.BooleanField(default=False, verbose_name=b'Enabled'),
+ ),
+ migrations.AddField(
+ model_name='siteconfigurationhistory',
+ name='enabled',
+ field=models.BooleanField(default=False, verbose_name=b'Enabled'),
+ ),
+ ]
diff --git a/openedx/core/djangoapps/site_configuration/models.py b/openedx/core/djangoapps/site_configuration/models.py
index e2885369aa..1a8ccd1f74 100644
--- a/openedx/core/djangoapps/site_configuration/models.py
+++ b/openedx/core/djangoapps/site_configuration/models.py
@@ -12,6 +12,10 @@ from django_extensions.db.models import TimeStampedModel
from jsonfield.fields import JSONField
+from logging import getLogger
+logger = getLogger(__name__) # pylint: disable=invalid-name
+
+
class SiteConfiguration(models.Model):
"""
Model for storing site configuration. These configuration override OpenEdx configurations and settings.
@@ -22,6 +26,7 @@ class SiteConfiguration(models.Model):
values (JSONField): json field to store configurations for a site
"""
site = models.OneToOneField(Site, related_name='configuration')
+ enabled = models.BooleanField(default=False, verbose_name="Enabled")
values = JSONField(
null=False,
blank=True,
@@ -34,6 +39,65 @@ class SiteConfiguration(models.Model):
def __repr__(self):
return self.__unicode__()
+ def get_value(self, name, default=None):
+ """
+ Return Configuration value for the key specified as name argument.
+
+ Function logs a message if configuration is not enabled or if there is an error retrieving a key.
+
+ Args:
+ name (str): Name of the key for which to return configuration value.
+ default: default value tp return if key is not found in the configuration
+
+ Returns:
+ Configuration value for the given key or returns `None` if configuration is not enabled.
+ """
+ if self.enabled:
+ try:
+ return self.values.get(name, default) # pylint: disable=no-member
+ except AttributeError as error:
+ logger.exception('Invalid JSON data. \n [%s]', error)
+ else:
+ logger.info("Site Configuration is not enabled for site (%s).", self.site)
+
+ return default
+
+ @classmethod
+ def get_value_for_org(cls, org, name, default=None):
+ """
+ This returns site configuration value which has an org_filter that matches
+ what is passed in,
+
+ Args:
+ org (str): Course ord filter, this value will be used to filter out the correct site configuration.
+ name (str): Name of the key for which to return configuration value.
+ default: default value tp return if key is not found in the configuration
+
+ Returns:
+ Configuration value for the given key.
+ """
+ for configuration in cls.objects.filter(values__contains=org, enabled=True).all():
+ org_filter = configuration.get_value('course_org_filter', None)
+ if org_filter == org:
+ return configuration.get_value(name, default)
+ return default
+
+ @classmethod
+ def get_all_orgs(cls):
+ """
+ This returns all of the orgs that are considered in site configurations, This can be used,
+ for example, to do filtering.
+
+ Returns:
+ Configuration value for the given key.
+ """
+ org_filter_set = set()
+ for configuration in cls.objects.filter(values__contains='course_org_filter', enabled=True).all():
+ org_filter = configuration.get_value('course_org_filter', None)
+ if org_filter:
+ org_filter_set.add(org_filter)
+ return org_filter_set
+
class SiteConfigurationHistory(TimeStampedModel):
"""
@@ -45,6 +109,7 @@ class SiteConfigurationHistory(TimeStampedModel):
values (JSONField): json field to store configurations for a site
"""
site = models.ForeignKey(Site, related_name='configuration_histories')
+ enabled = models.BooleanField(default=False, verbose_name="Enabled")
values = JSONField(
null=False,
blank=True,
@@ -74,4 +139,5 @@ def update_site_configuration_history(sender, instance, **kwargs): # pylint: di
SiteConfigurationHistory.objects.create(
site=instance.site,
values=instance.values,
+ enabled=instance.enabled,
)
diff --git a/openedx/core/djangoapps/site_configuration/templatetags/__init__.py b/openedx/core/djangoapps/site_configuration/templatetags/__init__.py
new file mode 100644
index 0000000000..d78893e095
--- /dev/null
+++ b/openedx/core/djangoapps/site_configuration/templatetags/__init__.py
@@ -0,0 +1,3 @@
+"""
+Django template tags for configurations.
+"""
diff --git a/common/djangoapps/microsite_configuration/templatetags/microsite.py b/openedx/core/djangoapps/site_configuration/templatetags/configuration.py
similarity index 62%
rename from common/djangoapps/microsite_configuration/templatetags/microsite.py
rename to openedx/core/djangoapps/site_configuration/templatetags/configuration.py
index a8e2095636..7e7e3a2814 100644
--- a/common/djangoapps/microsite_configuration/templatetags/microsite.py
+++ b/openedx/core/djangoapps/site_configuration/templatetags/configuration.py
@@ -1,37 +1,25 @@
"""
Template tags and helper functions for displaying breadcrumbs in page titles
-based on the current micro site.
+based on the current site.
"""
from django import template
from django.conf import settings
-from microsite_configuration import microsite
from django.templatetags.static import static
from django.contrib.staticfiles.storage import staticfiles_storage
-register = template.Library()
+from openedx.core.djangoapps.theming import helpers as theming_helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
-
-def page_title_breadcrumbs(*crumbs, **kwargs):
- """
- This function creates a suitable page title in the form:
- Specific | Less Specific | General | edX
- It will output the correct platform name for the request.
- Pass in a `separator` kwarg to override the default of " | "
- """
- separator = kwargs.get("separator", " | ")
- if crumbs:
- return u'{}{}{}'.format(separator.join(crumbs), separator, platform_name())
- else:
- return platform_name()
+register = template.Library() # pylint: disable=invalid-name
@register.simple_tag(name="page_title_breadcrumbs", takes_context=True)
-def page_title_breadcrumbs_tag(context, *crumbs):
+def page_title_breadcrumbs_tag(context, *crumbs): # pylint: disable=unused-argument
"""
Django template that creates breadcrumbs for page titles:
{% page_title_breadcrumbs "Specific" "Less Specific" General %}
"""
- return page_title_breadcrumbs(*crumbs)
+ return configuration_helpers.page_title_breadcrumbs(*crumbs)
@register.simple_tag(name="platform_name")
@@ -40,7 +28,7 @@ def platform_name():
Django template tag that outputs the current platform name:
{% platform_name %}
"""
- return microsite.get_value('platform_name', settings.PLATFORM_NAME)
+ return configuration_helpers.get_value('platform_name', settings.PLATFORM_NAME)
@register.simple_tag(name="favicon_path")
@@ -49,7 +37,7 @@ def favicon_path(default=getattr(settings, 'FAVICON_PATH', 'images/favicon.ico')
Django template tag that outputs the configured favicon:
{% favicon_path %}
"""
- return staticfiles_storage.url(microsite.get_value('favicon_path', default))
+ return staticfiles_storage.url(configuration_helpers.get_value('favicon_path', default))
@register.simple_tag(name="microsite_css_overrides_file")
@@ -58,7 +46,7 @@ def microsite_css_overrides_file():
Django template tag that outputs the css import for a:
{% microsite_css_overrides_file %}
"""
- file_path = microsite.get_value('css_overrides_file', None)
+ file_path = configuration_helpers.get_value('css_overrides_file', None)
if file_path is not None:
return " ".format(static(file_path))
else:
@@ -72,5 +60,5 @@ def microsite_template_path(template_name):
The django_templates loader does not support the leading slash, therefore
it is stripped before returning.
"""
- template_name = microsite.get_template_path(template_name)
+ template_name = theming_helpers.get_template_path(template_name)
return template_name[1:] if template_name[0] == '/' else template_name
diff --git a/openedx/core/djangoapps/site_configuration/tests/factories.py b/openedx/core/djangoapps/site_configuration/tests/factories.py
index 061b2925ff..7a5dee1ea9 100644
--- a/openedx/core/djangoapps/site_configuration/tests/factories.py
+++ b/openedx/core/djangoapps/site_configuration/tests/factories.py
@@ -14,3 +14,4 @@ class SiteConfigurationFactory(DjangoModelFactory):
model = SiteConfiguration
values = {}
+ enabled = True
diff --git a/openedx/core/djangoapps/site_configuration/tests/test_context_processors.py b/openedx/core/djangoapps/site_configuration/tests/test_context_processors.py
new file mode 100644
index 0000000000..4a7fee8c4c
--- /dev/null
+++ b/openedx/core/djangoapps/site_configuration/tests/test_context_processors.py
@@ -0,0 +1,37 @@
+"""
+Tests for Django template context processors.
+"""
+from django.test import TestCase
+from django.test.client import RequestFactory
+from django.test.utils import override_settings
+
+from openedx.core.djangoapps.site_configuration.context_processors import configuration_context
+from openedx.core.djangoapps.site_configuration.tests.test_util import (
+ with_site_configuration,
+)
+PLATFORM_NAME = 'Test Platform'
+
+
+@override_settings(PLATFORM_NAME=PLATFORM_NAME)
+class ContextProcessorTests(TestCase):
+ """
+ Tests for the configuration context processor.
+ """
+
+ def test_platform_name(self):
+ """
+ Verify the context includes the platform name.
+ """
+ request = RequestFactory().get('/')
+ context = configuration_context(request)
+
+ self.assertEqual(context['platform_name'], PLATFORM_NAME)
+
+ @with_site_configuration(configuration={"platform_name": "Testing Configuration Platform Name"})
+ def test_configuration_platform_name(self):
+ """
+ Verify the context includes correct platform name.
+ """
+ request = RequestFactory().get('/')
+ context = configuration_context(request)
+ self.assertEqual(context['platform_name'], "Testing Configuration Platform Name")
diff --git a/openedx/core/djangoapps/site_configuration/tests/test_helpers.py b/openedx/core/djangoapps/site_configuration/tests/test_helpers.py
new file mode 100644
index 0000000000..4edad72b5d
--- /dev/null
+++ b/openedx/core/djangoapps/site_configuration/tests/test_helpers.py
@@ -0,0 +1,160 @@
+"""
+Tests for helper function provided by site_configuration app.
+"""
+
+from django.test import TestCase
+
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
+from openedx.core.djangoapps.site_configuration.tests.test_util import (
+ with_site_configuration,
+ with_site_configuration_context,
+)
+
+test_config = { # pylint: disable=invalid-name
+ "university": "Test University",
+ "platform_name": "Test Education Program",
+ "SITE_NAME": "test.localhost",
+ "course_org_filter": "TestX",
+ "css_overrides_file": "test/css/site.css",
+ "ENABLE_MKTG_SITE": False,
+ "ENABLE_THIRD_PARTY_AUTH": False,
+ "course_about_show_social_links": False,
+ "favicon_path": "/static/test.ico",
+
+ "REGISTRATION_EXTRA_FIELDS": {
+ "first_name": "required",
+ "last_name": "required",
+ "level_of_education": "hidden",
+ "gender": "hidden",
+ "year_of_birth": "required",
+ "mailing_address": "hidden",
+ "goals": "hidden",
+ "terms_of_service": "required",
+ "honor_code": "hidden",
+ "state": "required",
+ "country": "required"
+ },
+}
+
+
+class TestHelpers(TestCase):
+ """
+ Tests for helper function provided by site_configuration.
+ """
+
+ @with_site_configuration(configuration=test_config)
+ def test_get_value(self):
+ """
+ Test that get_value returns correct value for any given key.
+ """
+ # Make sure entry is saved and retrieved correctly
+ self.assertEqual(configuration_helpers.get_value("university"), test_config['university'])
+ self.assertEqual(configuration_helpers.get_value("platform_name"), test_config['platform_name'])
+ self.assertEqual(configuration_helpers.get_value("SITE_NAME"), test_config['SITE_NAME'])
+ self.assertEqual(configuration_helpers.get_value("course_org_filter"), test_config['course_org_filter'])
+ self.assertEqual(configuration_helpers.get_value("css_overrides_file"), test_config['css_overrides_file'])
+ self.assertEqual(configuration_helpers.get_value("ENABLE_MKTG_SITE"), test_config['ENABLE_MKTG_SITE'])
+ self.assertEqual(configuration_helpers.get_value("favicon_path"), test_config['favicon_path'])
+ self.assertEqual(
+ configuration_helpers.get_value("ENABLE_THIRD_PARTY_AUTH"),
+ test_config['ENABLE_THIRD_PARTY_AUTH'],
+ )
+ self.assertEqual(
+ configuration_helpers.get_value("course_about_show_social_links"),
+ test_config['course_about_show_social_links'],
+ )
+
+ # Test that the default value is returned if the value for the given key is not found in the configuration
+ self.assertEqual(
+ configuration_helpers.get_value("non_existent_name", "dummy-default-value"),
+ "dummy-default-value",
+ )
+
+ @with_site_configuration(configuration=test_config)
+ def test_get_dict(self):
+ """
+ Test that get_dict returns correct value for any given key.
+ """
+ # Make sure entry is saved and retrieved correctly
+ self.assertItemsEqual(
+ configuration_helpers.get_dict("REGISTRATION_EXTRA_FIELDS"),
+ test_config['REGISTRATION_EXTRA_FIELDS'],
+ )
+
+ default = {"test1": 123, "first_name": "Test"}
+ expected = default
+ expected.update(test_config['REGISTRATION_EXTRA_FIELDS'])
+
+ # Test that the default value is returned if the value for the given key is not found in the configuration
+ self.assertItemsEqual(
+ configuration_helpers.get_dict("REGISTRATION_EXTRA_FIELDS", default),
+ expected,
+ )
+
+ @with_site_configuration(configuration=test_config)
+ def test_has_override_value(self):
+ """
+ Test that has_override_value returns correct value for any given key.
+ """
+
+ self.assertTrue(configuration_helpers.has_override_value("university"))
+ self.assertTrue(configuration_helpers.has_override_value("platform_name"))
+ self.assertTrue(configuration_helpers.has_override_value("ENABLE_MKTG_SITE"))
+ self.assertTrue(configuration_helpers.has_override_value("REGISTRATION_EXTRA_FIELDS"))
+
+ self.assertFalse(configuration_helpers.has_override_value("non_existent_key"))
+
+ def test_is_site_configuration_enabled(self):
+ """
+ Test that is_site_configuration_enabled returns True when configuration is enabled.
+ """
+ with with_site_configuration_context(configuration=test_config):
+ self.assertTrue(configuration_helpers.is_site_configuration_enabled())
+
+ # Test without a Site Configuration
+ self.assertFalse(configuration_helpers.is_site_configuration_enabled())
+
+ def test_get_value_for_org(self):
+ """
+ Test that get_value_for_org returns correct value for any given key.
+ """
+ test_org = test_config['course_org_filter']
+ with with_site_configuration_context(configuration=test_config):
+ self.assertEqual(
+ configuration_helpers.get_value_for_org(test_org, "university"),
+ test_config['university']
+ )
+ self.assertEqual(
+ configuration_helpers.get_value_for_org(test_org, "css_overrides_file"),
+ test_config['css_overrides_file']
+ )
+
+ self.assertItemsEqual(
+ configuration_helpers.get_value_for_org(test_org, "REGISTRATION_EXTRA_FIELDS"),
+ test_config['REGISTRATION_EXTRA_FIELDS']
+ )
+
+ # Test default value of key is not present in configuration
+ self.assertEqual(
+ configuration_helpers.get_value_for_org(test_org, "non_existent_key"),
+ None
+ )
+ self.assertEqual(
+ configuration_helpers.get_value_for_org(test_org, "non_existent_key", "default for non existent"),
+ "default for non existent"
+ )
+ self.assertEqual(
+ configuration_helpers.get_value_for_org("missing_org", "university", "default for non existent"),
+ "default for non existent"
+ )
+
+ def test_get_all_orgs(self):
+ """
+ Test that get_all_orgs returns correct values.
+ """
+ test_orgs = [test_config['course_org_filter']]
+ with with_site_configuration_context(configuration=test_config):
+ self.assertItemsEqual(
+ list(configuration_helpers.get_all_orgs()),
+ test_orgs,
+ )
diff --git a/openedx/core/djangoapps/site_configuration/tests/test_models.py b/openedx/core/djangoapps/site_configuration/tests/test_models.py
index 510b8d5174..e05984fb0c 100644
--- a/openedx/core/djangoapps/site_configuration/tests/test_models.py
+++ b/openedx/core/djangoapps/site_configuration/tests/test_models.py
@@ -1,12 +1,13 @@
"""
Tests for site configuration's django models.
"""
+from mock import patch
from django.test import TestCase
from django.db import IntegrityError, transaction
from django.contrib.sites.models import Site
-from openedx.core.djangoapps.site_configuration.models import SiteConfigurationHistory
+from openedx.core.djangoapps.site_configuration.models import SiteConfigurationHistory, SiteConfiguration
from openedx.core.djangoapps.site_configuration.tests.factories import SiteConfigurationFactory
@@ -17,10 +18,38 @@ class SiteConfigurationTests(TestCase):
domain = 'site_configuration_post_save_receiver_example.com'
name = 'site_configuration_post_save_receiver_example'
+ test_config1 = {
+ "university": "Test University",
+ "platform_name": "Test Education Program",
+ "SITE_NAME": "test.localhost",
+ "course_org_filter": "TestX",
+ "css_overrides_file": "test/css/site.css",
+ "ENABLE_MKTG_SITE": False,
+ "ENABLE_THIRD_PARTY_AUTH": False,
+ "course_about_show_social_links": False,
+ "favicon_path": "/static/test.ico",
+ }
+
+ test_config2 = {
+ "university": "Test Another University",
+ "platform_name": "Test Another Education Program",
+ "SITE_NAME": "test-another.localhost",
+ "course_org_filter": "TestAnotherX",
+ "css_overrides_file": "test-another/css/site.css",
+ "ENABLE_MKTG_SITE": True,
+ "ENABLE_THIRD_PARTY_AUTH": True,
+ "course_about_show_social_links": False,
+ "favicon_path": "/static/test-another.ico",
+ }
+
@classmethod
def setUpClass(cls):
super(SiteConfigurationTests, cls).setUpClass()
cls.site, _ = Site.objects.get_or_create(domain=cls.domain, name=cls.domain)
+ cls.site2, _ = Site.objects.get_or_create(
+ domain=cls.test_config2['SITE_NAME'],
+ name=cls.test_config2['SITE_NAME'],
+ )
def test_site_configuration_post_save_receiver(self):
"""
@@ -91,3 +120,200 @@ class SiteConfigurationTests(TestCase):
# Make sure no entry is saved if there an error
self.assertEqual(len(site_configuration_history), 1)
+
+ def test_get_value(self):
+ """
+ Test that get_value returns correct value for any given key.
+ """
+ # add SiteConfiguration to database
+ site_configuration = SiteConfigurationFactory.create(
+ site=self.site,
+ values=self.test_config1,
+ )
+
+ # Make sure entry is saved and retrieved correctly
+ self.assertEqual(site_configuration.get_value("university"), self.test_config1['university'])
+ self.assertEqual(site_configuration.get_value("platform_name"), self.test_config1['platform_name'])
+ self.assertEqual(site_configuration.get_value("SITE_NAME"), self.test_config1['SITE_NAME'])
+ self.assertEqual(site_configuration.get_value("course_org_filter"), self.test_config1['course_org_filter'])
+ self.assertEqual(site_configuration.get_value("css_overrides_file"), self.test_config1['css_overrides_file'])
+ self.assertEqual(site_configuration.get_value("ENABLE_MKTG_SITE"), self.test_config1['ENABLE_MKTG_SITE'])
+ self.assertEqual(site_configuration.get_value("favicon_path"), self.test_config1['favicon_path'])
+ self.assertEqual(
+ site_configuration.get_value("ENABLE_THIRD_PARTY_AUTH"),
+ self.test_config1['ENABLE_THIRD_PARTY_AUTH'],
+ )
+ self.assertEqual(
+ site_configuration.get_value("course_about_show_social_links"),
+ self.test_config1['course_about_show_social_links'],
+ )
+
+ # Test that the default value is returned if the value for the given key is not found in the configuration
+ self.assertEqual(
+ site_configuration.get_value("non_existent_name", "dummy-default-value"),
+ "dummy-default-value",
+ )
+
+ # Test that the default value is returned if Site configuration is not enabled
+ site_configuration.enabled = False
+ site_configuration.save()
+
+ self.assertEqual(site_configuration.get_value("university"), None)
+ self.assertEqual(
+ site_configuration.get_value("platform_name", "Default Platform Name"),
+ "Default Platform Name",
+ )
+ self.assertEqual(site_configuration.get_value("SITE_NAME", "Default Site Name"), "Default Site Name")
+
+ def test_invalid_data_error_on_get_value(self):
+ """
+ Test that get_value logs an error if json data is not valid.
+ """
+ # import logger, for patching
+ from openedx.core.djangoapps.site_configuration.models import logger
+ invalid_data = [self.test_config1]
+
+ # add SiteConfiguration to database
+ site_configuration = SiteConfigurationFactory.create(
+ site=self.site,
+ values=invalid_data,
+ )
+
+ # make sure get_value logs an error for invalid json data
+ with patch.object(logger, "exception") as mock_logger:
+ self.assertEqual(site_configuration.get_value("university"), None)
+ self.assertTrue(mock_logger.called)
+
+ # make sure get_value returns default_value for invalid json data
+ with patch.object(logger, "exception") as mock_logger:
+ value = site_configuration.get_value("platform_name", "Default Platform Name")
+ self.assertTrue(mock_logger.called)
+ self.assertEqual(value, "Default Platform Name")
+
+ def test_get_value_for_org(self):
+ """
+ Test that get_value_for_org returns correct value for any given key.
+ """
+ # add SiteConfiguration to database
+ SiteConfigurationFactory.create(
+ site=self.site,
+ values=self.test_config1,
+ )
+ SiteConfigurationFactory.create(
+ site=self.site2,
+ values=self.test_config2,
+ )
+
+ # Make sure entry is saved and retrieved correctly
+ self.assertEqual(
+ SiteConfiguration.get_value_for_org(self.test_config1['course_org_filter'], "university"),
+ self.test_config1['university'],
+ )
+ self.assertEqual(
+ SiteConfiguration.get_value_for_org(self.test_config1['course_org_filter'], "platform_name"),
+ self.test_config1['platform_name'],
+ )
+ self.assertEqual(
+ SiteConfiguration.get_value_for_org(self.test_config1['course_org_filter'], "SITE_NAME"),
+ self.test_config1['SITE_NAME'],
+ )
+ self.assertEqual(
+ SiteConfiguration.get_value_for_org(self.test_config1['course_org_filter'], "css_overrides_file"),
+ self.test_config1['css_overrides_file'],
+ )
+ self.assertEqual(
+ SiteConfiguration.get_value_for_org(self.test_config1['course_org_filter'], "ENABLE_MKTG_SITE"),
+ self.test_config1['ENABLE_MKTG_SITE'],
+ )
+
+ # Make sure entry is saved and retrieved correctly
+ self.assertEqual(
+ SiteConfiguration.get_value_for_org(self.test_config2['course_org_filter'], "university"),
+ self.test_config2['university'],
+ )
+ self.assertEqual(
+ SiteConfiguration.get_value_for_org(self.test_config2['course_org_filter'], "platform_name"),
+ self.test_config2['platform_name'],
+ )
+ self.assertEqual(
+ SiteConfiguration.get_value_for_org(self.test_config2['course_org_filter'], "SITE_NAME"),
+ self.test_config2['SITE_NAME'],
+ )
+ self.assertEqual(
+ SiteConfiguration.get_value_for_org(self.test_config2['course_org_filter'], "css_overrides_file"),
+ self.test_config2['css_overrides_file'],
+ )
+ self.assertEqual(
+ SiteConfiguration.get_value_for_org(self.test_config2['course_org_filter'], "ENABLE_MKTG_SITE"),
+ self.test_config2['ENABLE_MKTG_SITE'],
+ )
+
+ # Test that the default value is returned if the value for the given key is not found in the configuration
+ self.assertEqual(
+ SiteConfiguration.get_value_for_org(
+ self.test_config1['course_org_filter'],
+ "non-existent",
+ "dummy-default-value"),
+ "dummy-default-value",
+ )
+
+ # Test that the default value is returned if the value for the given key is not found in the configuration
+ self.assertEqual(
+ SiteConfiguration.get_value_for_org(
+ self.test_config2['course_org_filter'],
+ "non-existent",
+ "dummy-default-value"),
+ "dummy-default-value",
+ )
+
+ # Test that the default value is returned if org is not found in the configuration
+ self.assertEqual(
+ SiteConfiguration.get_value_for_org(
+ "non-existent-org",
+ "platform_name",
+ "dummy-default-value"),
+ "dummy-default-value",
+ )
+
+ def test_get_all_orgs(self):
+ """
+ Test that get_all_orgs returns all orgs from site configuration.
+ """
+ expected_orgs = [self.test_config1['course_org_filter'], self.test_config2['course_org_filter']]
+ # add SiteConfiguration to database
+ SiteConfigurationFactory.create(
+ site=self.site,
+ values=self.test_config1,
+ )
+ SiteConfigurationFactory.create(
+ site=self.site2,
+ values=self.test_config2,
+ )
+
+ # Test that the default value is returned if the value for the given key is not found in the configuration
+ self.assertListEqual(
+ list(SiteConfiguration.get_all_orgs()),
+ expected_orgs,
+ )
+
+ def test_get_all_orgs_returns_only_enabled(self):
+ """
+ Test that get_all_orgs returns only those orgs whose configurations are enabled.
+ """
+ expected_orgs = [self.test_config2['course_org_filter']]
+ # add SiteConfiguration to database
+ SiteConfigurationFactory.create(
+ site=self.site,
+ values=self.test_config1,
+ enabled=False,
+ )
+ SiteConfigurationFactory.create(
+ site=self.site2,
+ values=self.test_config2,
+ )
+
+ # Test that the default value is returned if the value for the given key is not found in the configuration
+ self.assertListEqual(
+ list(SiteConfiguration.get_all_orgs()),
+ expected_orgs,
+ )
diff --git a/openedx/core/djangoapps/site_configuration/tests/test_util.py b/openedx/core/djangoapps/site_configuration/tests/test_util.py
new file mode 100644
index 0000000000..ad4f7efd55
--- /dev/null
+++ b/openedx/core/djangoapps/site_configuration/tests/test_util.py
@@ -0,0 +1,58 @@
+"""
+Test helpers for Site Configuration.
+"""
+
+from functools import wraps
+import contextlib
+
+from mock import patch
+
+from django.contrib.sites.models import Site
+
+from openedx.core.djangoapps.site_configuration.models import SiteConfiguration
+
+
+def with_site_configuration(domain="test.localhost", configuration=None):
+ """
+ A decorator to run a test with a configuration enabled.
+
+ Args:
+ domain (str): domain name for the test site.
+ configuration (dict): configuration to use for the test site.
+ """
+ # This decorator creates Site and SiteConfiguration instances for given domain
+ def _decorator(func): # pylint: disable=missing-docstring
+ @wraps(func)
+ def _decorated(*args, **kwargs): # pylint: disable=missing-docstring
+ # make a domain name out of directory name
+ site, __ = Site.objects.get_or_create(domain=domain, name=domain)
+ site_configuration, __ = SiteConfiguration.objects.get_or_create(
+ site=site, enabled=True, values=configuration,
+ )
+
+ with patch('openedx.core.djangoapps.site_configuration.helpers.get_current_site_configuration',
+ return_value=site_configuration):
+ with patch('openedx.core.djangoapps.theming.helpers.get_current_site', return_value=site):
+ return func(*args, **kwargs)
+ return _decorated
+ return _decorator
+
+
+@contextlib.contextmanager
+def with_site_configuration_context(domain="test.localhost", configuration=None):
+ """
+ A function to get a context manger to run a test with a configuration enabled.
+
+ Args:
+ domain (str): domain name for the test site.
+ configuration (dict): configuration to use for the test site.
+ """
+ site, __ = Site.objects.get_or_create(domain=domain, name=domain)
+ site_configuration, __ = SiteConfiguration.objects.get_or_create(
+ site=site, enabled=True, values=configuration,
+ )
+
+ with patch('openedx.core.djangoapps.site_configuration.helpers.get_current_site_configuration',
+ return_value=site_configuration):
+ with patch('openedx.core.djangoapps.theming.helpers.get_current_site', return_value=site):
+ yield
diff --git a/openedx/core/djangoapps/theming/helpers.py b/openedx/core/djangoapps/theming/helpers.py
index e9c30caff2..de3d90fa5c 100644
--- a/openedx/core/djangoapps/theming/helpers.py
+++ b/openedx/core/djangoapps/theming/helpers.py
@@ -10,44 +10,13 @@ from django.contrib.staticfiles.storage import staticfiles_storage
from request_cache.middleware import RequestCache
-from microsite_configuration import microsite, page_title_breadcrumbs
+from microsite_configuration import microsite
+
from logging import getLogger
logger = getLogger(__name__) # pylint: disable=invalid-name
-def get_page_title_breadcrumbs(*args):
- """
- This is a proxy function to hide microsite_configuration behind comprehensive theming.
- """
- return page_title_breadcrumbs(*args)
-
-
-def get_value(val_name, default=None, **kwargs):
- """
- This is a proxy function to hide microsite_configuration behind comprehensive theming.
- """
-
- # Retrieve the requested field/value from the microsite configuration
- microsite_value = microsite.get_value(val_name, default=default, **kwargs)
-
- # Attempt to perform a dictionary update using the provided default
- # This will fail if either the default or the microsite value is not a dictionary
- try:
- value = dict(default)
- value.update(microsite_value)
-
- # If the dictionary update fails, just use the microsite value
- # TypeError: default is not iterable (simple value or None)
- # ValueError: default is iterable but not a dict (list, not dict)
- # AttributeError: default does not have an 'update' method
- except (TypeError, ValueError, AttributeError):
- value = microsite_value
-
- # Return the end result to the caller
- return value
-
-
def get_template_path(relative_path, **kwargs):
"""
This is a proxy function to hide microsite_configuration behind comprehensive theming.
@@ -180,7 +149,7 @@ def get_current_request():
Return current request instance.
Returns:
- (HttpRequest): returns cirrent request
+ (HttpRequest): returns current request
"""
return RequestCache.get_current_request()
diff --git a/openedx/core/djangoapps/theming/tests/test_helpers.py b/openedx/core/djangoapps/theming/tests/test_helpers.py
index 091f6fe9a7..b7ca6dcc17 100644
--- a/openedx/core/djangoapps/theming/tests/test_helpers.py
+++ b/openedx/core/djangoapps/theming/tests/test_helpers.py
@@ -8,7 +8,7 @@ from django.test import TestCase, override_settings
from django.conf import settings
from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme
-from openedx.core.djangoapps.theming import helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.djangoapps.theming.helpers import get_template_path_with_theme, strip_site_theme_templates_path, \
get_themes, Theme, get_theme_base_dir
@@ -44,13 +44,13 @@ class TestHelpers(TestCase):
def test_get_value_returns_override(self):
"""
Tests to make sure the get_value() operation returns a combined dictionary consisting
- of the base container with overridden keys from the microsite configuration
+ of the base container with overridden keys from the site configuration
"""
- with patch('microsite_configuration.microsite.get_value') as mock_get_value:
+ with patch('openedx.core.djangoapps.site_configuration.helpers.get_value') as mock_get_value:
override_key = 'JWT_ISSUER'
override_value = 'testing'
mock_get_value.return_value = {override_key: override_value}
- jwt_auth = helpers.get_value('JWT_AUTH')
+ jwt_auth = configuration_helpers.get_value('JWT_AUTH')
self.assertEqual(jwt_auth[override_key], override_value)
diff --git a/openedx/core/djangoapps/user_api/accounts/api.py b/openedx/core/djangoapps/user_api/accounts/api.py
index 0361e3a761..890e803c3d 100644
--- a/openedx/core/djangoapps/user_api/accounts/api.py
+++ b/openedx/core/djangoapps/user_api/accounts/api.py
@@ -33,7 +33,7 @@ from .serializers import (
AccountLegacyProfileSerializer, AccountUserSerializer,
UserReadOnlySerializer, _visible_fields # pylint: disable=invalid-name
)
-from openedx.core.djangoapps.theming import helpers as theming_helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
# Public access point for this function.
@@ -398,7 +398,7 @@ def request_password_change(email, orig_host, is_secure):
# Generate a single-use link for performing a password reset
# and email it to the user.
form.save(
- from_email=theming_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
+ from_email=configuration_helpers.get_value('email_from_address', settings.DEFAULT_FROM_EMAIL),
domain_override=orig_host,
use_https=is_secure
)
diff --git a/openedx/core/djangoapps/user_api/accounts/image_helpers.py b/openedx/core/djangoapps/user_api/accounts/image_helpers.py
index b204d6daf6..9e7eaed7f0 100644
--- a/openedx/core/djangoapps/user_api/accounts/image_helpers.py
+++ b/openedx/core/djangoapps/user_api/accounts/image_helpers.py
@@ -8,10 +8,9 @@ from django.core.exceptions import ObjectDoesNotExist
from django.core.files.storage import get_storage_class
from django.contrib.staticfiles.storage import staticfiles_storage
-from microsite_configuration import microsite
-
from student.models import UserProfile
from ..errors import UserNotFound
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
PROFILE_IMAGE_FILE_EXTENSION = 'jpg' # All processed profile images are converted to JPEGs
@@ -121,7 +120,7 @@ def _get_default_profile_image_urls():
TODO The result of this function should be memoized, but not in tests.
"""
return _get_profile_image_urls(
- microsite.get_value('PROFILE_IMAGE_DEFAULT_FILENAME', settings.PROFILE_IMAGE_DEFAULT_FILENAME),
+ configuration_helpers.get_value('PROFILE_IMAGE_DEFAULT_FILENAME', settings.PROFILE_IMAGE_DEFAULT_FILENAME),
staticfiles_storage,
file_extension=settings.PROFILE_IMAGE_DEFAULT_FILE_EXTENSION,
)
diff --git a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py
index 55025e357f..834afc4047 100644
--- a/openedx/core/djangoapps/user_api/accounts/tests/test_views.py
+++ b/openedx/core/djangoapps/user_api/accounts/tests/test_views.py
@@ -337,7 +337,7 @@ class TestAccountAPI(CacheIsolationTestCase, UserAPITestCase):
self.assertEqual(False, data["accomplishments_shared"])
self.client.login(username=self.user.username, password=self.test_password)
- verify_get_own_information(16)
+ verify_get_own_information(17)
# Now make sure that the user can get the same information, even if not active
self.user.is_active = False
@@ -356,7 +356,7 @@ class TestAccountAPI(CacheIsolationTestCase, UserAPITestCase):
legacy_profile.save()
self.client.login(username=self.user.username, password=self.test_password)
- with self.assertNumQueries(16):
+ with self.assertNumQueries(17):
response = self.send_get(self.client)
for empty_field in ("level_of_education", "gender", "country", "bio"):
self.assertIsNone(response.data[empty_field])
diff --git a/openedx/core/djangoapps/user_api/views.py b/openedx/core/djangoapps/user_api/views.py
index 1328863772..506ee3d9b4 100644
--- a/openedx/core/djangoapps/user_api/views.py
+++ b/openedx/core/djangoapps/user_api/views.py
@@ -28,7 +28,7 @@ from edxmako.shortcuts import marketing_link
from student.forms import get_registration_extension_form
from student.views import create_account_with_params
from student.cookies import set_logged_in_cookies
-from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.core.lib.api.authentication import SessionAuthenticationAllowInactiveUser
from util.json_request import JsonResponse
from .preferences.api import update_email_opt_in
@@ -77,7 +77,7 @@ class LoginSessionView(APIView):
# Translators: These instructions appear on the login form, immediately
# below a field meant to hold the user's email address.
email_instructions = _("The email address you used to register with {platform_name}").format(
- platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)
+ platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
)
form_desc.add_field(
@@ -193,7 +193,7 @@ class RegistrationView(APIView):
# Backwards compatibility: Honor code is required by default, unless
# explicitly set to "optional" in Django settings.
- self._extra_fields_setting = copy.deepcopy(get_themed_value('REGISTRATION_EXTRA_FIELDS'))
+ self._extra_fields_setting = copy.deepcopy(configuration_helpers.get_value('REGISTRATION_EXTRA_FIELDS'))
if not self._extra_fields_setting:
self._extra_fields_setting = copy.deepcopy(settings.REGISTRATION_EXTRA_FIELDS)
self._extra_fields_setting["honor_code"] = self._extra_fields_setting.get("honor_code", "required")
@@ -586,7 +586,7 @@ class RegistrationView(APIView):
# Translators: This phrase appears above a field on the registration form
# meant to hold the user's reasons for registering with edX.
goals_label = _(u"Tell us why you're interested in {platform_name}").format(
- platform_name=get_themed_value("PLATFORM_NAME", settings.PLATFORM_NAME)
+ platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME)
)
form_desc.add_field(
@@ -771,14 +771,14 @@ class RegistrationView(APIView):
# Translators: "Terms of Service" is a legal document users must agree to
# in order to register a new account.
label = _(u"I agree to the {platform_name} {terms_of_service}.").format(
- platform_name=get_themed_value("PLATFORM_NAME", settings.PLATFORM_NAME),
+ platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME),
terms_of_service=terms_link
)
# Translators: "Terms of Service" is a legal document users must agree to
# in order to register a new account.
error_msg = _(u"You must agree to the {platform_name} {terms_of_service}.").format(
- platform_name=get_themed_value("PLATFORM_NAME", settings.PLATFORM_NAME),
+ platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME),
terms_of_service=terms_link
)
@@ -814,14 +814,14 @@ class RegistrationView(APIView):
# Translators: "Terms of service" is a legal document users must agree to
# in order to register a new account.
label = _(u"I agree to the {platform_name} {terms_of_service}.").format(
- platform_name=get_themed_value("PLATFORM_NAME", settings.PLATFORM_NAME),
+ platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME),
terms_of_service=terms_link
)
# Translators: "Terms of service" is a legal document users must agree to
# in order to register a new account.
error_msg = _(u"You must agree to the {platform_name} {terms_of_service}.").format(
- platform_name=get_themed_value("PLATFORM_NAME", settings.PLATFORM_NAME),
+ platform_name=configuration_helpers.get_value("PLATFORM_NAME", settings.PLATFORM_NAME),
terms_of_service=terms_link
)
@@ -920,7 +920,7 @@ class PasswordResetView(APIView):
# Translators: These instructions appear on the password reset form,
# immediately below a field meant to hold the user's email address.
email_instructions = _(u"The email address you used to register with {platform_name}").format(
- platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)
+ platform_name=configuration_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
)
form_desc.add_field(
diff --git a/openedx/core/lib/token_utils.py b/openedx/core/lib/token_utils.py
index d351a8d226..3191d8828b 100644
--- a/openedx/core/lib/token_utils.py
+++ b/openedx/core/lib/token_utils.py
@@ -7,7 +7,7 @@ from django.conf import settings
from django.utils.functional import cached_property
import jwt
-from openedx.core.djangoapps.theming import helpers
+from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from student.models import UserProfile, anonymous_id_for_user
@@ -31,7 +31,7 @@ class JwtBuilder(object):
self.user = user
self.asymmetric = asymmetric
self.secret = secret
- self.jwt_auth = helpers.get_value('JWT_AUTH', settings.JWT_AUTH)
+ self.jwt_auth = configuration_helpers.get_value('JWT_AUTH', settings.JWT_AUTH)
def build_token(self, scopes, expires_in, aud=None):
"""Returns a JWT access token.
diff --git a/themes/README.rst b/themes/README.rst
index 162363e67f..c87d8fc0c5 100644
--- a/themes/README.rst
+++ b/themes/README.rst
@@ -206,24 +206,23 @@ In addition, there are some other changes you'll need to make:
JavaScript will be included automatically on your site using that account ID.
You can set this account ID either using the "GOOGLE_ANALYTICS_ACCOUNT" value
in the Django settings, or by setting the newly-added "GOOGLE_ANALYTICS_ACCOUNT"
- config value in your microsite configuration.
+ config value in your site configuration.
* If you don't want the Google Analytics JavaScript to be output at all in your
- microsite, set the "GOOGLE_ANALYTICS_ACCOUNT" config value to the empty string.
+ site, set the "GOOGLE_ANALYTICS_ACCOUNT" config value to the empty string.
If you want to customize the way that Google Analytics is loaded, set the
"GOOGLE_ANALYTICS_ACCOUNT" config value to the empty string, and then load
Google Analytics yourself (with whatever customizations you want) in your
``head-extra.html`` template.
* The ``css_overrides_file`` config value is now ignored. To add a CSS override
- file to your microsite, create a ``head-extra.html`` template with the
+ file to your site configuration, create a ``head-extra.html`` template with the
following content:
.. code-block:: mako
<%namespace name='static' file='../../static_content.html'/>
- <%! from microsite_configuration import microsite %>
- <% style_overrides_file = microsite.get_value('css_overrides_file') %>
+ <% style_overrides_file = static.get_value('css_overrides_file') %>
% if style_overrides_file:
diff --git a/themes/edx.org/lms/templates/dashboard.html b/themes/edx.org/lms/templates/dashboard.html
index bde2cca40b..65ac64cb28 100644
--- a/themes/edx.org/lms/templates/dashboard.html
+++ b/themes/edx.org/lms/templates/dashboard.html
@@ -6,11 +6,11 @@ from django.utils.translation import ugettext as _
from django.template import RequestContext
import third_party_auth
from third_party_auth import pipeline
-from microsite_configuration import microsite
from django.core.urlresolvers import reverse
import json
from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_string
from openedx.core.djangolib.markup import HTML, Text
+from openedx.core.djangoapps.theming import helpers as theming_helpers
%>
<%
@@ -188,7 +188,7 @@ from openedx.core.djangolib.markup import HTML, Text
% endif
- <%include file="${microsite.get_template_path('dashboard/_dashboard_status_verification.html')}" />
+ <%include file="${theming_helpers.get_template_path('dashboard/_dashboard_status_verification.html')}" />
diff --git a/themes/red-theme/lms/templates/footer.html b/themes/red-theme/lms/templates/footer.html
index 3570d92901..cb1ca3a070 100755
--- a/themes/red-theme/lms/templates/footer.html
+++ b/themes/red-theme/lms/templates/footer.html
@@ -53,7 +53,7 @@ from django.utils.translation import ugettext as _
- © ${settings.COPYRIGHT_YEAR} ${settings.PLATFORM_NAME}.
+ © ${settings.COPYRIGHT_YEAR} ${static.get_platform_name()}.
## Site operators: Please do not remove this paragraph! This attributes back to edX and makes your acknowledgement of edX's trademarks clear.
diff --git a/themes/red-theme/lms/templates/header.html b/themes/red-theme/lms/templates/header.html
index 050ed074ab..1200057d89 100755
--- a/themes/red-theme/lms/templates/header.html
+++ b/themes/red-theme/lms/templates/header.html
@@ -11,7 +11,6 @@ import branding
# app that handles site status messages
from status.status import get_site_status_msg
-from microsite_configuration import microsite
from lms.djangoapps.ccx.overrides import get_current_ccx
%>