diff --git a/lms/templates/commerce/checkout_cancel.html b/lms/templates/commerce/checkout_cancel.html
index d2f03e07d0..08566ddb3c 100644
--- a/lms/templates/commerce/checkout_cancel.html
+++ b/lms/templates/commerce/checkout_cancel.html
@@ -1,4 +1,7 @@
-<%! from django.utils.translation import ugettext as _ %>
+<%page expression_filter="h"/>
+<%! from django.utils.translation import ugettext as _
+from openedx.core.djangolib.markup import HTML, Text
+%>
<%inherit file="../main.html" />
@@ -7,6 +10,6 @@
${_("Checkout Cancelled")}
- ${ _(u"Your transaction has been cancelled. If you feel an error has occurred, contact {email}.").format(
- email="{email}".format(email=payment_support_email)) }
+ ${ Text(_(u"Your transaction has been cancelled. If you feel an error has occurred, contact {email}.")).format(
+ email=HTML("{email}").format(email=payment_support_email)) }
diff --git a/lms/templates/commerce/checkout_error.html b/lms/templates/commerce/checkout_error.html
index df170377f4..ecc8dc596a 100644
--- a/lms/templates/commerce/checkout_error.html
+++ b/lms/templates/commerce/checkout_error.html
@@ -1,4 +1,7 @@
-<%! from django.utils.translation import ugettext as _ %>
+<%page expression_filter="h"/>
+<%! from django.utils.translation import ugettext as _
+from openedx.core.djangolib.markup import HTML, Text
+%>
<%inherit file="../main.html" />
@@ -7,6 +10,8 @@
${_("Checkout Error")}
- ${ _(u"An error has occurred with your payment. You have not been charged. Please try to submit your payment again. If this problem persists, contact {email}.").format(
- email="{email}".format(email=payment_support_email)) }
+ ${ Text(_(u"An error has occurred with your payment. {b_start}You have not been charged.{b_end} Please try to submit your payment again. If this problem persists, contact {email}.")).format(
+ b_start=HTML(''),
+ b_end=HTML(''),
+ email=HTML("{email}").format(email=payment_support_email)) }
diff --git a/lms/templates/commerce/checkout_receipt.html b/lms/templates/commerce/checkout_receipt.html
index 0d4587fb14..2b89d30100 100644
--- a/lms/templates/commerce/checkout_receipt.html
+++ b/lms/templates/commerce/checkout_receipt.html
@@ -1,3 +1,4 @@
+<%page expression_filter="h"/>
<%!
from django.utils.translation import ugettext as _
%>
diff --git a/lms/templates/courseware/courseware-error.html b/lms/templates/courseware/courseware-error.html
index a07b7fa266..2d7babaf28 100644
--- a/lms/templates/courseware/courseware-error.html
+++ b/lms/templates/courseware/courseware-error.html
@@ -1,4 +1,7 @@
-<%! from django.utils.translation import ugettext as _ %>
+<%page expression_filter="h"/>
+<%! from django.utils.translation import ugettext as _
+from openedx.core.djangolib.markup import HTML, Text
+%>
<%inherit file="/main.html" />
<%namespace name='static' file='../static_content.html'/>
<%block name="bodyclass">courseware%block>
@@ -18,14 +21,14 @@ from openedx.core.djangolib.markup import HTML, Text
- ${_('There has been an error on the {platform_name} servers').format(
- platform_name=u'{}'.format(static.get_platform_name())
+ ${Text(_('There has been an error on the {platform_name} servers')).format(
+ platform_name=HTML(u'{}').format(static.get_platform_name())
)}
- ${_("We're sorry, this module is temporarily unavailable. Our staff is working to fix "
- "it as soon as possible. Please email us at {tech_support_email} to report any problems or downtime.").format(
- tech_support_email=u'{0}'.format(static.get_tech_support_email_address())
+ ${Text(_("We're sorry, this module is temporarily unavailable. Our staff is working to fix "
+ "it as soon as possible. Please email us at {tech_support_email} to report any problems or downtime.")).format(
+ tech_support_email=HTML(u'{0}').format(static.get_tech_support_email_address())
)}
diff --git a/lms/templates/debug/run_python_form.html b/lms/templates/debug/run_python_form.html
index 2d29480f4c..0c2abbfe80 100644
--- a/lms/templates/debug/run_python_form.html
+++ b/lms/templates/debug/run_python_form.html
@@ -1,3 +1,4 @@
+<%page expression_filter="h"/>
<%! from django.utils.translation import ugettext as _ %>
@@ -5,7 +6,7 @@
@@ -14,7 +15,7 @@
${_("Results:")}
-${results|h}
+${results}
%endif
diff --git a/lms/templates/email_change_failed.html b/lms/templates/email_change_failed.html
index 557925c862..8fbe6c4654 100644
--- a/lms/templates/email_change_failed.html
+++ b/lms/templates/email_change_failed.html
@@ -1,4 +1,7 @@
-<%! from django.utils.translation import ugettext as _ %>
+<%page expression_filter="h"/>
+<%! from django.utils.translation import ugettext as _
+from openedx.core.djangolib.markup import HTML, Text
+%>
<%inherit file="main.html" />
@@ -14,6 +17,8 @@
${_("We were unable to send a confirmation email to {email}").format(email=email)}
% endif
-
${_('Go back to the {link_start}home page{link_end}.').format(link_start='', link_end='')}
+
${Text(_('Go back to the {link_start}home page{link_end}.')).format(
+ link_start=HTML(''),
+ link_end=HTML(''))}
diff --git a/lms/templates/email_change_successful.html b/lms/templates/email_change_successful.html
index b58972785c..e91da6a294 100644
--- a/lms/templates/email_change_successful.html
+++ b/lms/templates/email_change_successful.html
@@ -1,6 +1,8 @@
+<%page expression_filter="h"/>
<%inherit file="main.html" />
<%!
from django.utils.translation import ugettext as _
+from openedx.core.djangolib.markup import HTML, Text
from django.urls import reverse
%>
@@ -10,9 +12,9 @@ from django.urls import reverse
diff --git a/lms/templates/lti.html b/lms/templates/lti.html
index e87bef0084..486c5d652d 100644
--- a/lms/templates/lti.html
+++ b/lms/templates/lti.html
@@ -1,3 +1,4 @@
+<%page expression_filter="h"/>
<%!
import json
from django.utils.translation import ugettext as _
@@ -61,7 +62,7 @@ from django.utils.translation import ugettext as _
${_("Feedback on your work from the grader:")}
## sanitized with bleach in view
- ${comment}
+ ${comment | n, decode.utf8}
% endif
diff --git a/lms/templates/peer_grading/peer_grading_closed.html b/lms/templates/peer_grading/peer_grading_closed.html
index af5b606674..698d3763bc 100644
--- a/lms/templates/peer_grading/peer_grading_closed.html
+++ b/lms/templates/peer_grading/peer_grading_closed.html
@@ -1,3 +1,4 @@
+<%page expression_filter="h"/>
<%! from django.utils.translation import ugettext as _ %>
${_("Peer Grading")}
diff --git a/lms/templates/provider_login.html b/lms/templates/provider_login.html
index d252261621..ae8307e4ab 100644
--- a/lms/templates/provider_login.html
+++ b/lms/templates/provider_login.html
@@ -1,3 +1,4 @@
+<%page expression_filter="h"/>
<%! from django.utils.translation import ugettext as _ %>
<%inherit file="main.html" />
diff --git a/lms/templates/register-form.html b/lms/templates/register-form.html
index aa543efe73..0a4cb5d5ff 100644
--- a/lms/templates/register-form.html
+++ b/lms/templates/register-form.html
@@ -1,7 +1,9 @@
+<%page expression_filter="h"/>
<%!
import third_party_auth
from third_party_auth import pipeline, provider
from django.utils.translation import ugettext as _
+from openedx.core.djangolib.markup import HTML, Text
from django_countries import countries
from student.models import UserProfile
%>
@@ -26,7 +28,7 @@ from student.models import UserProfile
% for enabled in provider.Registry.displayed_for_login():
## Translators: provider_name is the name of an external, third-party user authentication service (like Google or LinkedIn).
-