Commit 603546a0 by Ibrahim

replace references to settings.PLATFORM_NAME in edx-platform with theme overrides

parent 5f159591
...@@ -21,6 +21,7 @@ from social.backends.saml import SAMLAuth, SAMLIdentityProvider ...@@ -21,6 +21,7 @@ from social.backends.saml import SAMLAuth, SAMLIdentityProvider
from .lti import LTIAuthBackend, LTI_PARAMS_KEY from .lti import LTIAuthBackend, LTI_PARAMS_KEY
from social.exceptions import SocialAuthBaseException from social.exceptions import SocialAuthBaseException
from social.utils import module_member from social.utils import module_member
from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -453,7 +454,7 @@ class SAMLConfiguration(ConfigurationModel): ...@@ -453,7 +454,7 @@ class SAMLConfiguration(ConfigurationModel):
other_config = json.loads(self.other_config_str) other_config = json.loads(self.other_config_str)
if name in ("TECHNICAL_CONTACT", "SUPPORT_CONTACT"): if name in ("TECHNICAL_CONTACT", "SUPPORT_CONTACT"):
contact = { contact = {
"givenName": "{} Support".format(settings.PLATFORM_NAME), "givenName": "{} Support".format(get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)),
"emailAddress": settings.TECH_SUPPORT_EMAIL "emailAddress": settings.TECH_SUPPORT_EMAIL
} }
contact.update(other_config.get(name, {})) contact.update(other_config.get(name, {}))
......
...@@ -116,7 +116,7 @@ def _get_course_email_context(course): ...@@ -116,7 +116,7 @@ def _get_course_email_context(course):
'course_end_date': course_end_date, 'course_end_date': course_end_date,
'account_settings_url': 'https://{}{}'.format(settings.SITE_NAME, reverse('account_settings')), 'account_settings_url': 'https://{}{}'.format(settings.SITE_NAME, reverse('account_settings')),
'email_settings_url': 'https://{}{}'.format(settings.SITE_NAME, reverse('dashboard')), '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 return email_context
......
...@@ -17,6 +17,7 @@ from wiki.models import URLPath, Article ...@@ -17,6 +17,7 @@ from wiki.models import URLPath, Article
from courseware.courses import get_course_by_id from courseware.courses import get_course_by_id
from course_wiki.utils import course_wiki_slug from course_wiki.utils import course_wiki_slug
from opaque_keys.edx.locations import SlashSeparatedCourseKey from opaque_keys.edx.locations import SlashSeparatedCourseKey
from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -128,7 +129,8 @@ def get_or_create_root(): ...@@ -128,7 +129,8 @@ def get_or_create_root():
pass pass
starting_content = "\n".join(( 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."), _("Visit a course wiki to add an article."),
)) ))
......
...@@ -1090,7 +1090,7 @@ def generate_user_cert(request, course_id): ...@@ -1090,7 +1090,7 @@ def generate_user_cert(request, course_id):
log.info(u"Anon user trying to generate certificate for %s", course_id) log.info(u"Anon user trying to generate certificate for %s", course_id)
return HttpResponseBadRequest( return HttpResponseBadRequest(
_('You must be signed in to {platform_name} to create a certificate.').format( _('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 = _( ...@@ -1206,7 +1206,7 @@ FINANCIAL_ASSISTANCE_HEADER = _(
' financial assistance program.' ' financial assistance program.'
).format( ).format(
percent_sign="%", percent_sign="%",
platform_name=settings.PLATFORM_NAME platform_name=theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME)
).split('\n') ).split('\n')
...@@ -1326,7 +1326,7 @@ def financial_assistance_form(request): ...@@ -1326,7 +1326,7 @@ def financial_assistance_form(request):
'student_faq_url': marketing_link('FAQ'), 'student_faq_url': marketing_link('FAQ'),
'dashboard_url': reverse('dashboard'), 'dashboard_url': reverse('dashboard'),
'account_settings_url': reverse('account_settings'), 'account_settings_url': reverse('account_settings'),
'platform_name': settings.PLATFORM_NAME, 'platform_name': theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
'user_details': { 'user_details': {
'email': user.email, 'email': user.email,
'username': user.username, 'username': user.username,
......
...@@ -215,7 +215,7 @@ def require_global_staff(func): ...@@ -215,7 +215,7 @@ def require_global_staff(func):
else: else:
return HttpResponseForbidden( return HttpResponseForbidden(
u"Must be {platform_name} staff to perform this action.".format( 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 return wrapped
......
...@@ -33,6 +33,7 @@ from django.core.mail.message import EmailMessage ...@@ -33,6 +33,7 @@ from django.core.mail.message import EmailMessage
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from eventtracking import tracker 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 courseware.courses import get_course_by_id
from config_models.models import ConfigurationModel from config_models.models import ConfigurationModel
from course_modes.models import CourseMode from course_modes.models import CourseMode
...@@ -2185,7 +2186,7 @@ class Donation(OrderItem): ...@@ -2185,7 +2186,7 @@ class Donation(OrderItem):
u"We greatly appreciate this generous contribution and your support of the {platform_name} mission. " 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"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." 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 @classmethod
def _line_item_description(cls, course_id=None): def _line_item_description(cls, course_id=None):
...@@ -2218,7 +2219,8 @@ class Donation(OrderItem): ...@@ -2218,7 +2219,8 @@ class Donation(OrderItem):
# The donation is for the organization as a whole, not a specific course # The donation is for the organization as a whole, not a specific course
else: 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 @property
def single_item_receipt_context(self): def single_item_receipt_context(self):
...@@ -2243,8 +2245,8 @@ class Donation(OrderItem): ...@@ -2243,8 +2245,8 @@ class Donation(OrderItem):
data['name'] = unicode(self.course_id) data['name'] = unicode(self.course_id)
data['category'] = unicode(self.course_id.org) data['category'] = unicode(self.course_id.org)
else: else:
data['name'] = settings.PLATFORM_NAME data['name'] = get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)
data['category'] = settings.PLATFORM_NAME data['category'] = get_themed_value('PLATFORM_NAME', settings.PLATFORM_NAME)
return data return data
@property @property
......
...@@ -419,7 +419,7 @@ class PayAndVerifyView(View): ...@@ -419,7 +419,7 @@ class PayAndVerifyView(View):
'display_steps': display_steps, 'display_steps': display_steps,
'is_active': json.dumps(request.user.is_active), 'is_active': json.dumps(request.user.is_active),
'message_key': message, 'message_key': message,
'platform_name': settings.PLATFORM_NAME, 'platform_name': theming_helpers.get_value('PLATFORM_NAME', settings.PLATFORM_NAME),
'processors': processors, 'processors': processors,
'requirements': requirements, 'requirements': requirements,
'user_full_name': full_name, 'user_full_name': full_name,
...@@ -1184,7 +1184,7 @@ def _compose_message_reverification_email( ...@@ -1184,7 +1184,7 @@ def _compose_message_reverification_email(
context["verification_open"] = verification_open context["verification_open"] = verification_open
context["due_date"] = get_default_time_display(reverification_block.due) 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["used_attempts"] = used_attempts
context["allowed_attempts"] = allowed_attempts context["allowed_attempts"] = allowed_attempts
context["support_link"] = microsite.get_value('email_from_address', settings.CONTACT_EMAIL) context["support_link"] = microsite.get_value('email_from_address', settings.CONTACT_EMAIL)
...@@ -1384,7 +1384,7 @@ class ReverifyView(View): ...@@ -1384,7 +1384,7 @@ class ReverifyView(View):
if status in ["none", "must_reverify", "expired", "pending"]: if status in ["none", "must_reverify", "expired", "pending"]:
context = { context = {
"user_full_name": request.user.profile.name, "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"), "capture_sound": staticfiles_storage.url("audio/camera_capture.wav"),
} }
return render_to_response("verify_student/reverify.html", context) return render_to_response("verify_student/reverify.html", context)
...@@ -1449,7 +1449,7 @@ class InCourseReverifyView(View): ...@@ -1449,7 +1449,7 @@ class InCourseReverifyView(View):
'course_key': unicode(course_key), 'course_key': unicode(course_key),
'course_name': course.display_name_with_default_escaped, 'course_name': course.display_name_with_default_escaped,
'checkpoint_name': checkpoint.checkpoint_name, '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, 'usage_id': usage_id,
'capture_sound': staticfiles_storage.url("audio/camera_capture.wav"), 'capture_sound': staticfiles_storage.url("audio/camera_capture.wav"),
} }
......
...@@ -17,6 +17,7 @@ from edxmako.shortcuts import render_to_string ...@@ -17,6 +17,7 @@ from edxmako.shortcuts import render_to_string
from simple_history.models import HistoricalRecords from simple_history.models import HistoricalRecords
from config_models.models import ConfigurationModel from config_models.models import ConfigurationModel
from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -161,7 +162,7 @@ def _send_decision_email(instance): ...@@ -161,7 +162,7 @@ def _send_decision_email(instance):
'authentication_docs_url': settings.AUTH_DOCUMENTATION_URL, 'authentication_docs_url': settings.AUTH_DOCUMENTATION_URL,
'api_docs_url': settings.API_DOCUMENTATION_URL, 'api_docs_url': settings.API_DOCUMENTATION_URL,
'support_email_address': settings.API_ACCESS_FROM_EMAIL, '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( message = render_to_string(
......
...@@ -7,6 +7,7 @@ from django.forms.widgets import CheckboxInput ...@@ -7,6 +7,7 @@ from django.forms.widgets import CheckboxInput
from django.utils.encoding import force_text from django.utils.encoding import force_text
from django.utils.html import format_html from django.utils.html import format_html
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from openedx.core.djangoapps.theming.helpers import get_value as get_themed_value
class TermsOfServiceCheckboxInput(CheckboxInput): class TermsOfServiceCheckboxInput(CheckboxInput):
...@@ -23,7 +24,7 @@ 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. # 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. # 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( 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='<a href="{url}" target="_blank">'.format(url=reverse('api_admin:api-tos')), link_start='<a href="{url}" target="_blank">'.format(url=reverse('api_admin:api-tos')),
link_end='</a>', link_end='</a>',
) )
......
...@@ -73,7 +73,7 @@ def send_credit_notifications(username, course_key): ...@@ -73,7 +73,7 @@ def send_credit_notifications(username, course_key):
providers_string = make_providers_strings(providers_names) providers_string = make_providers_strings(providers_names)
context = { context = {
'full_name': user.get_full_name(), '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, 'course_name': course_display_name,
'branded_logo': logo_image_id, 'branded_logo': logo_image_id,
'dashboard_link': dashboard_link, 'dashboard_link': dashboard_link,
......
...@@ -586,7 +586,7 @@ class RegistrationView(APIView): ...@@ -586,7 +586,7 @@ class RegistrationView(APIView):
# Translators: This phrase appears above a field on the registration form # Translators: This phrase appears above a field on the registration form
# meant to hold the user's reasons for registering with edX. # meant to hold the user's reasons for registering with edX.
goals_label = _(u"Tell us why you're interested in {platform_name}").format( 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( form_desc.add_field(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment