From 9d3b65282e8f589e4cdc31a71720c5c1c8a91f71 Mon Sep 17 00:00:00 2001 From: louyihua Date: Sat, 28 Mar 2015 21:47:59 +0800 Subject: [PATCH] Fix error when STUDIO_NAME uses non-ascii characters The replacement strings need to be unicode, so that when STUDIO_NAME contains non-ascii characters python can handle it correctly without raising exceptions. Also, the value of STUDIO_SHORT_NAME can be read from cms.env.json. --- cms/envs/aws.py | 1 + cms/templates/500.html | 2 +- cms/templates/howitworks.html | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cms/envs/aws.py b/cms/envs/aws.py index 8ed8c08d57..e78bae1c41 100644 --- a/cms/envs/aws.py +++ b/cms/envs/aws.py @@ -199,6 +199,7 @@ LOGGING = get_logger_config(LOG_DIR, #theming start: PLATFORM_NAME = ENV_TOKENS.get('PLATFORM_NAME', 'edX') STUDIO_NAME = ENV_TOKENS.get('STUDIO_NAME', 'edX Studio') +STUDIO_SHORT_NAME = ENV_TOKENS.get('STUDIO_SHORT_NAME', 'Studio') TENDER_DOMAIN = ENV_TOKENS.get('TENDER_DOMAIN', TENDER_DOMAIN) TENDER_SUBDOMAIN = ENV_TOKENS.get('TENDER_SUBDOMAIN', TENDER_SUBDOMAIN) diff --git a/cms/templates/500.html b/cms/templates/500.html index bdf94a2285..31ec1dd958 100644 --- a/cms/templates/500.html +++ b/cms/templates/500.html @@ -9,7 +9,7 @@

${_("The {studio_name} servers encountered an error").format( - studio_name="{studio_name}".format(studio_name=settings.STUDIO_SHORT_NAME) + studio_name=u"{studio_name}".format(studio_name=settings.STUDIO_SHORT_NAME) )}

diff --git a/cms/templates/howitworks.html b/cms/templates/howitworks.html index ec1b4b78f1..34f77329d0 100644 --- a/cms/templates/howitworks.html +++ b/cms/templates/howitworks.html @@ -16,7 +16,7 @@
## "edX Studio" should not be translated

${_("Welcome to {studio_name}").format( - studio_name=''.format( + studio_name=u''.format( studio_name=settings.STUDIO_NAME ) )}