diff --git a/common/djangoapps/third_party_auth/models.py b/common/djangoapps/third_party_auth/models.py index ce76ef20c5..5bd8f22200 100644 --- a/common/djangoapps/third_party_auth/models.py +++ b/common/djangoapps/third_party_auth/models.py @@ -21,6 +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 log = logging.getLogger(__name__) @@ -453,7 +454,7 @@ class SAMLConfiguration(ConfigurationModel): other_config = json.loads(self.other_config_str) if name in ("TECHNICAL_CONTACT", "SUPPORT_CONTACT"): contact = { - "givenName": "{} Support".format(settings.PLATFORM_NAME), + "givenName": "{} Support".format(get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)), "emailAddress": settings.TECH_SUPPORT_EMAIL } contact.update(other_config.get(name, {})) diff --git a/lms/djangoapps/bulk_email/tasks.py b/lms/djangoapps/bulk_email/tasks.py index 3fd044fd94..a7947a6f6b 100644 --- a/lms/djangoapps/bulk_email/tasks.py +++ b/lms/djangoapps/bulk_email/tasks.py @@ -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': settings.PLATFORM_NAME, + 'platform_name': theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME), } return email_context diff --git a/lms/djangoapps/course_wiki/views.py b/lms/djangoapps/course_wiki/views.py index 92372e828e..f1681a4e7f 100644 --- a/lms/djangoapps/course_wiki/views.py +++ b/lms/djangoapps/course_wiki/views.py @@ -17,6 +17,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 log = logging.getLogger(__name__) @@ -128,7 +129,8 @@ def get_or_create_root(): pass starting_content = "\n".join(( - _("Welcome to the {platform_name} Wiki").format(platform_name=settings.PLATFORM_NAME), + _("Welcome to the {platform_name} Wiki").format(platform_name=get_themed_value('PLATFORM_NAME', + settings.PLATFORM_NAME)), "===", _("Visit a course wiki to add an article."), )) diff --git a/lms/djangoapps/courseware/views/views.py b/lms/djangoapps/courseware/views/views.py index 698f49c1d6..565dbe4617 100644 --- a/lms/djangoapps/courseware/views/views.py +++ b/lms/djangoapps/courseware/views/views.py @@ -1090,7 +1090,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=settings.PLATFORM_NAME + platform_name=theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME) ) ) @@ -1206,7 +1206,7 @@ FINANCIAL_ASSISTANCE_HEADER = _( ' financial assistance program.' ).format( percent_sign="%", - platform_name=settings.PLATFORM_NAME + platform_name=theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME) ).split('\n') @@ -1326,7 +1326,7 @@ def financial_assistance_form(request): 'student_faq_url': marketing_link('FAQ'), 'dashboard_url': reverse('dashboard'), 'account_settings_url': reverse('account_settings'), - 'platform_name': settings.PLATFORM_NAME, + 'platform_name': theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME), 'user_details': { 'email': user.email, 'username': user.username, diff --git a/lms/djangoapps/instructor/views/api.py b/lms/djangoapps/instructor/views/api.py index d709d342eb..9f3b8ea674 100644 --- a/lms/djangoapps/instructor/views/api.py +++ b/lms/djangoapps/instructor/views/api.py @@ -215,7 +215,7 @@ def require_global_staff(func): else: return HttpResponseForbidden( u"Must be {platform_name} staff to perform this action.".format( - platform_name=settings.PLATFORM_NAME + platform_name=theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME) ) ) return wrapped diff --git a/lms/djangoapps/shoppingcart/models.py b/lms/djangoapps/shoppingcart/models.py index 173fd5b96f..2f000babc7 100644 --- a/lms/djangoapps/shoppingcart/models.py +++ b/lms/djangoapps/shoppingcart/models.py @@ -33,6 +33,7 @@ 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 @@ -2185,7 +2186,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=settings.PLATFORM_NAME) + ).format(platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)) @classmethod def _line_item_description(cls, course_id=None): @@ -2218,7 +2219,8 @@ 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=settings.PLATFORM_NAME) + return _(u"Donation for {platform_name}").format(platform_name=get_themed_value('PLATFORM_NAME', + settings.PLATFORM_NAME)) @property def single_item_receipt_context(self): @@ -2243,8 +2245,8 @@ class Donation(OrderItem): data['name'] = unicode(self.course_id) data['category'] = unicode(self.course_id.org) else: - data['name'] = settings.PLATFORM_NAME - data['category'] = settings.PLATFORM_NAME + data['name'] = get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME) + data['category'] = get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME) return data @property diff --git a/lms/djangoapps/verify_student/views.py b/lms/djangoapps/verify_student/views.py index 21715ba979..a58e89f6ee 100644 --- a/lms/djangoapps/verify_student/views.py +++ b/lms/djangoapps/verify_student/views.py @@ -419,7 +419,7 @@ class PayAndVerifyView(View): 'display_steps': display_steps, 'is_active': json.dumps(request.user.is_active), 'message_key': message, - 'platform_name': settings.PLATFORM_NAME, + 'platform_name': theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME), 'processors': processors, 'requirements': requirements, 'user_full_name': full_name, @@ -1184,7 +1184,7 @@ def _compose_message_reverification_email( context["verification_open"] = verification_open context["due_date"] = get_default_time_display(reverification_block.due) - context['platform_name'] = settings.PLATFORM_NAME + context['platform_name'] = theming_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) @@ -1384,7 +1384,7 @@ class ReverifyView(View): if status in ["none", "must_reverify", "expired", "pending"]: context = { "user_full_name": request.user.profile.name, - "platform_name": settings.PLATFORM_NAME, + "platform_name": theming_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) @@ -1449,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': settings.PLATFORM_NAME, + 'platform_name': theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME), 'usage_id': usage_id, 'capture_sound': staticfiles_storage.url("audio/camera_capture.wav"), } diff --git a/openedx/core/djangoapps/api_admin/models.py b/openedx/core/djangoapps/api_admin/models.py index eb5c2600e4..57c16338d4 100644 --- a/openedx/core/djangoapps/api_admin/models.py +++ b/openedx/core/djangoapps/api_admin/models.py @@ -17,6 +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 log = logging.getLogger(__name__) @@ -161,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': settings.PLATFORM_NAME + 'platform_name': get_themed_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 0b1e5f4600..f51800f09b 100644 --- a/openedx/core/djangoapps/api_admin/widgets.py +++ b/openedx/core/djangoapps/api_admin/widgets.py @@ -7,6 +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 class TermsOfServiceCheckboxInput(CheckboxInput): @@ -23,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=settings.PLATFORM_NAME, + platform_name=get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME), link_start=''.format(url=reverse('api_admin:api-tos')), link_end='', ) diff --git a/openedx/core/djangoapps/credit/email_utils.py b/openedx/core/djangoapps/credit/email_utils.py index 263cee2fce..3cdef8955c 100644 --- a/openedx/core/djangoapps/credit/email_utils.py +++ b/openedx/core/djangoapps/credit/email_utils.py @@ -73,7 +73,7 @@ def send_credit_notifications(username, course_key): providers_string = make_providers_strings(providers_names) context = { 'full_name': user.get_full_name(), - 'platform_name': settings.PLATFORM_NAME, + 'platform_name': theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME), 'course_name': course_display_name, 'branded_logo': logo_image_id, 'dashboard_link': dashboard_link, diff --git a/openedx/core/djangoapps/user_api/views.py b/openedx/core/djangoapps/user_api/views.py index 38cfde0ab6..1328863772 100644 --- a/openedx/core/djangoapps/user_api/views.py +++ b/openedx/core/djangoapps/user_api/views.py @@ -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=settings.PLATFORM_NAME + platform_name=get_themed_value("PLATFORM_NAME", settings.PLATFORM_NAME) ) form_desc.add_field(