From 7223ee9316c4592b44669b2d1349f39a83592a47 Mon Sep 17 00:00:00 2001 From: Robert Raposa Date: Mon, 23 May 2016 08:47:08 -0400 Subject: [PATCH 1/2] Fix import order for HTML, Text. --- cms/templates/404.html | 2 +- cms/templates/500.html | 2 +- cms/templates/asset_index.html | 2 +- cms/templates/container.html | 2 +- cms/templates/course_outline.html | 2 +- cms/templates/group_configurations.html | 2 +- cms/templates/index.html | 2 +- lms/djangoapps/instructor/views/instructor_dashboard.py | 2 +- lms/templates/api_admin/status.html | 2 +- lms/templates/ccx/enrollment.html | 2 +- lms/templates/courseware/accordion.html | 2 +- lms/templates/courseware/info.html | 2 +- lms/templates/courseware/welcome-back.html | 2 +- lms/templates/dashboard.html | 2 +- .../dashboard/_dashboard_certificate_information.html | 2 +- lms/templates/dashboard/_dashboard_course_listing.html | 2 +- lms/templates/dashboard/_dashboard_xseries_info.html | 2 +- lms/templates/edxnotes/edxnotes.html | 2 +- lms/templates/help_modal.html | 2 +- lms/templates/index.html | 2 +- lms/templates/provider/authorize.html | 2 +- lms/templates/registration/password_reset_complete.html | 2 +- lms/templates/registration/password_reset_confirm.html | 2 +- lms/templates/static_templates/404.html | 2 +- lms/templates/static_templates/embargo.html | 2 +- lms/templates/static_templates/server-down.html | 2 +- lms/templates/static_templates/server-error.html | 2 +- lms/templates/static_templates/server-overloaded.html | 2 +- lms/templates/unsubscribe.html | 2 +- lms/templates/verify_student/pay_and_verify.html | 2 +- openedx/core/djangolib/markup.py | 2 +- openedx/core/djangolib/tests/test_markup.py | 4 ++-- themes/edx.org/lms/templates/dashboard.html | 2 +- 33 files changed, 34 insertions(+), 34 deletions(-) diff --git a/cms/templates/404.html b/cms/templates/404.html index 0c24c8dae8..e1ad0ac38b 100644 --- a/cms/templates/404.html +++ b/cms/templates/404.html @@ -1,7 +1,7 @@ <%page expression_filter="h"/> <%! from django.utils.translation import ugettext as _ -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%inherit file="base.html" /> <%block name="title">${_("Page Not Found")} diff --git a/cms/templates/500.html b/cms/templates/500.html index ffd3ed0e1a..bdebc79c13 100644 --- a/cms/templates/500.html +++ b/cms/templates/500.html @@ -1,6 +1,6 @@ <%page expression_filter="h"/> <%! -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text from django.utils.translation import ugettext as _ %> <%inherit file="base.html" /> diff --git a/cms/templates/asset_index.html b/cms/templates/asset_index.html index 793757b232..1fe9b7d251 100644 --- a/cms/templates/asset_index.html +++ b/cms/templates/asset_index.html @@ -4,7 +4,7 @@ <%! from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ - from openedx.core.djangolib.markup import Text, HTML + from openedx.core.djangolib.markup import HTML, Text from openedx.core.djangolib.js_utils import js_escaped_string, dump_js_escaped_json %> <%block name="title">${_("Files & Uploads")} diff --git a/cms/templates/container.html b/cms/templates/container.html index 872031c4c4..5d6acacae0 100644 --- a/cms/templates/container.html +++ b/cms/templates/container.html @@ -15,7 +15,7 @@ from contentstore.views.helpers import xblock_studio_url, xblock_type_display_na from openedx.core.djangolib.js_utils import ( dump_js_escaped_json, js_escaped_string ) -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%block name="title">${xblock.display_name_with_default} ${xblock_type_display_name(xblock)} diff --git a/cms/templates/course_outline.html b/cms/templates/course_outline.html index faf07b2b48..4f357db338 100644 --- a/cms/templates/course_outline.html +++ b/cms/templates/course_outline.html @@ -8,7 +8,7 @@ from django.utils.translation import ugettext as _ from openedx.core.djangolib.js_utils import dump_js_escaped_json from contentstore.utils import reverse_usage_url from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%block name="title">${_("Course Outline")} <%block name="bodyclass">is-signedin course view-outline diff --git a/cms/templates/group_configurations.html b/cms/templates/group_configurations.html index d20afd921b..2f08f64f14 100644 --- a/cms/templates/group_configurations.html +++ b/cms/templates/group_configurations.html @@ -9,7 +9,7 @@ from django.utils.translation import ugettext as _ from openedx.core.djangolib.js_utils import ( dump_js_escaped_json, js_escaped_string ) -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%block name="title">${_("Group Configurations")} diff --git a/cms/templates/index.html b/cms/templates/index.html index b4d7dc04ec..76d63a924a 100644 --- a/cms/templates/index.html +++ b/cms/templates/index.html @@ -2,7 +2,7 @@ <%! from django.utils.translation import ugettext as _ -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%inherit file="base.html" /> diff --git a/lms/djangoapps/instructor/views/instructor_dashboard.py b/lms/djangoapps/instructor/views/instructor_dashboard.py index fab0ee2127..bdf3b6aec9 100644 --- a/lms/djangoapps/instructor/views/instructor_dashboard.py +++ b/lms/djangoapps/instructor/views/instructor_dashboard.py @@ -53,7 +53,7 @@ from class_dashboard.dashboard_data import get_section_display_name, get_array_s from .tools import get_units_with_due_date, title_or_url from opaque_keys.edx.locations import SlashSeparatedCourseKey -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text log = logging.getLogger(__name__) diff --git a/lms/templates/api_admin/status.html b/lms/templates/api_admin/status.html index 7135d188f2..0d84b753ce 100644 --- a/lms/templates/api_admin/status.html +++ b/lms/templates/api_admin/status.html @@ -5,7 +5,7 @@ from django.utils.translation import ugettext as _ from openedx.core.djangoapps.api_admin.models import ApiAccessRequest -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %>
diff --git a/lms/templates/ccx/enrollment.html b/lms/templates/ccx/enrollment.html index 8d0ba6a994..750d86a415 100644 --- a/lms/templates/ccx/enrollment.html +++ b/lms/templates/ccx/enrollment.html @@ -1,7 +1,7 @@ <%page expression_filter="h"/> <%! from django.utils.translation import ugettext as _ -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %>
diff --git a/lms/templates/courseware/accordion.html b/lms/templates/courseware/accordion.html index 0f78cb0365..bee38eab0c 100644 --- a/lms/templates/courseware/accordion.html +++ b/lms/templates/courseware/accordion.html @@ -5,7 +5,7 @@ from util.date_utils import get_time_display from django.utils.translation import ugettext as _ from django.conf import settings - from openedx.core.djangolib.markup import Text, HTML + from openedx.core.djangolib.markup import HTML, Text %> <%def name="make_chapter(chapter)"> diff --git a/lms/templates/courseware/info.html b/lms/templates/courseware/info.html index ed414124e1..d57fbd9d70 100644 --- a/lms/templates/courseware/info.html +++ b/lms/templates/courseware/info.html @@ -7,7 +7,7 @@ from django.utils.translation import ugettext as _ from courseware.courses import get_course_info_section, get_course_date_summary from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%block name="pagetitle">${_("{course_number} Course Info").format(course_number=course.display_number_with_default)} diff --git a/lms/templates/courseware/welcome-back.html b/lms/templates/courseware/welcome-back.html index 94fff2ad11..fe0130ca14 100644 --- a/lms/templates/courseware/welcome-back.html +++ b/lms/templates/courseware/welcome-back.html @@ -1,7 +1,7 @@ <%page expression_filter="h"/> <%! from django.utils.translation import ugettext as _ -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %>

${chapter_module.display_name_with_default}

diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index ecb8447cca..a7123cfe9e 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -8,7 +8,7 @@ from django.template import RequestContext import third_party_auth from third_party_auth import pipeline from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_string -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <% diff --git a/lms/templates/dashboard/_dashboard_certificate_information.html b/lms/templates/dashboard/_dashboard_certificate_information.html index a07acf823f..0638fbf5a4 100644 --- a/lms/templates/dashboard/_dashboard_certificate_information.html +++ b/lms/templates/dashboard/_dashboard_certificate_information.html @@ -2,7 +2,7 @@ <%! from django.utils.translation import ugettext as _ -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text from course_modes.models import CourseMode %> <%namespace name='static' file='../static_content.html'/> diff --git a/lms/templates/dashboard/_dashboard_course_listing.html b/lms/templates/dashboard/_dashboard_course_listing.html index 38f503a101..ff190d44cc 100644 --- a/lms/templates/dashboard/_dashboard_course_listing.html +++ b/lms/templates/dashboard/_dashboard_course_listing.html @@ -9,7 +9,7 @@ from django.core.urlresolvers import reverse from course_modes.models import CourseMode from course_modes.helpers import enrollment_mode_display from openedx.core.djangolib.js_utils import dump_js_escaped_json -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text from student.helpers import ( VERIFY_STATUS_NEED_TO_VERIFY, VERIFY_STATUS_SUBMITTED, diff --git a/lms/templates/dashboard/_dashboard_xseries_info.html b/lms/templates/dashboard/_dashboard_xseries_info.html index 2a9533ff17..b196703683 100644 --- a/lms/templates/dashboard/_dashboard_xseries_info.html +++ b/lms/templates/dashboard/_dashboard_xseries_info.html @@ -1,7 +1,7 @@ <%page expression_filter="h" args="program_data, enrollment_mode, display_category" /> <%! from django.utils.translation import ugettext as _ - from openedx.core.djangolib.markup import Text, HTML + from openedx.core.djangolib.markup import HTML, Text %> <%namespace name='static' file='../static_content.html'/>
diff --git a/lms/templates/edxnotes/edxnotes.html b/lms/templates/edxnotes/edxnotes.html index 37146f4a4b..688b832691 100644 --- a/lms/templates/edxnotes/edxnotes.html +++ b/lms/templates/edxnotes/edxnotes.html @@ -5,7 +5,7 @@ <%! from django.utils.translation import ugettext as _ from edxnotes.helpers import NoteJSONEncoder -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_string %> diff --git a/lms/templates/help_modal.html b/lms/templates/help_modal.html index 25e413fe95..b8ab37971a 100644 --- a/lms/templates/help_modal.html +++ b/lms/templates/help_modal.html @@ -8,7 +8,7 @@ from django.conf import settings from django.utils.translation import ugettext as _ from django.core.urlresolvers import reverse from openedx.core.djangolib.js_utils import js_escaped_string -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text from xmodule.tabs import CourseTabList %> diff --git a/lms/templates/index.html b/lms/templates/index.html index c69f78a26d..bcf7d48d10 100644 --- a/lms/templates/index.html +++ b/lms/templates/index.html @@ -5,7 +5,7 @@ from django.utils.translation import ugettext as _ from django.core.urlresolvers import reverse -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %>
diff --git a/lms/templates/provider/authorize.html b/lms/templates/provider/authorize.html index 6181de9725..b6baa0fd0f 100644 --- a/lms/templates/provider/authorize.html +++ b/lms/templates/provider/authorize.html @@ -6,7 +6,7 @@ from django.utils.translation import ugettext as _ from provider.templatetags.scope import scopes from django.core.urlresolvers import reverse -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%inherit file="../main.html"/> diff --git a/lms/templates/registration/password_reset_complete.html b/lms/templates/registration/password_reset_complete.html index af83c40e1b..2bbfd8eb3d 100644 --- a/lms/templates/registration/password_reset_complete.html +++ b/lms/templates/registration/password_reset_complete.html @@ -4,7 +4,7 @@ <%! from django.utils.translation import ugettext as _ -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%inherit file="../main.html"/> diff --git a/lms/templates/registration/password_reset_confirm.html b/lms/templates/registration/password_reset_confirm.html index e28d16ecf0..ce2f741180 100644 --- a/lms/templates/registration/password_reset_confirm.html +++ b/lms/templates/registration/password_reset_confirm.html @@ -4,7 +4,7 @@ <%! from django.utils.translation import ugettext as _ -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%inherit file="../main.html"/> diff --git a/lms/templates/static_templates/404.html b/lms/templates/static_templates/404.html index 5e37c3881e..6bfbb411d5 100644 --- a/lms/templates/static_templates/404.html +++ b/lms/templates/static_templates/404.html @@ -2,7 +2,7 @@ <%namespace name='static' file='../static_content.html'/> <%! from django.utils.translation import ugettext as _ -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%inherit file="../main.html" /> diff --git a/lms/templates/static_templates/embargo.html b/lms/templates/static_templates/embargo.html index faa89a9570..ac62f76edd 100644 --- a/lms/templates/static_templates/embargo.html +++ b/lms/templates/static_templates/embargo.html @@ -1,7 +1,7 @@ <%page expression_filter="h"/> <%! from django.utils.translation import ugettext as _ -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%inherit file="../main.html" /> diff --git a/lms/templates/static_templates/server-down.html b/lms/templates/static_templates/server-down.html index 8b4f5efbf1..82a29116b8 100644 --- a/lms/templates/static_templates/server-down.html +++ b/lms/templates/static_templates/server-down.html @@ -1,7 +1,7 @@ <%page expression_filter="h"/> <%! from django.utils.translation import ugettext as _ -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%inherit file="../main.html" /> diff --git a/lms/templates/static_templates/server-error.html b/lms/templates/static_templates/server-error.html index 4993a6033b..c89ace1000 100644 --- a/lms/templates/static_templates/server-error.html +++ b/lms/templates/static_templates/server-error.html @@ -2,7 +2,7 @@ <%namespace name='static' file='../static_content.html'/> <%! from django.utils.translation import ugettext as _ -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%inherit file="../main.html" /> diff --git a/lms/templates/static_templates/server-overloaded.html b/lms/templates/static_templates/server-overloaded.html index 09fe1a11de..c75f13f34c 100644 --- a/lms/templates/static_templates/server-overloaded.html +++ b/lms/templates/static_templates/server-overloaded.html @@ -1,7 +1,7 @@ <%page expression_filter="h"/> <%! from django.utils.translation import ugettext as _ -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <%inherit file="../main.html" /> diff --git a/lms/templates/unsubscribe.html b/lms/templates/unsubscribe.html index 0460572263..b065476ac5 100644 --- a/lms/templates/unsubscribe.html +++ b/lms/templates/unsubscribe.html @@ -1,6 +1,6 @@ <%page expression_filter="h"/> <%! -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ from django.conf import settings diff --git a/lms/templates/verify_student/pay_and_verify.html b/lms/templates/verify_student/pay_and_verify.html index ada91b0c51..4b591204dd 100644 --- a/lms/templates/verify_student/pay_and_verify.html +++ b/lms/templates/verify_student/pay_and_verify.html @@ -3,7 +3,7 @@ import json from django.utils.translation import ugettext as _ -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text from lms.djangoapps.verify_student.views import PayAndVerifyView %> <%namespace name='static' file='../static_content.html'/> diff --git a/openedx/core/djangolib/markup.py b/openedx/core/djangolib/markup.py index 319ec94845..3d8e4fa472 100644 --- a/openedx/core/djangolib/markup.py +++ b/openedx/core/djangolib/markup.py @@ -23,7 +23,7 @@ def HTML(html): # pylint: disable=invalid-name <%! from django.utils.translation import ugettext as _ - from openedx.core.djangolib.markup import Text, HTML + from openedx.core.djangolib.markup import HTML, Text %> ${Text(_("Write & send {start}email{end}")).format( start=HTML("").format(user.email), diff --git a/openedx/core/djangolib/tests/test_markup.py b/openedx/core/djangolib/tests/test_markup.py index 30c7403b7b..f410a91c9e 100644 --- a/openedx/core/djangolib/tests/test_markup.py +++ b/openedx/core/djangolib/tests/test_markup.py @@ -10,7 +10,7 @@ import ddt from django.utils.translation import ugettext as _, ungettext from mako.template import Template -from openedx.core.djangolib.markup import Text, HTML +from openedx.core.djangolib.markup import HTML, Text @attr('shard_2') @@ -60,7 +60,7 @@ class FormatHtmlTest(unittest.TestCase): <%! from django.utils.translation import ugettext as _ - from openedx.core.djangolib.markup import Text, HTML + from openedx.core.djangolib.markup import HTML, Text %> ${Text(_(u"A & {BC}")).format(BC=HTML("B & C"))} """, diff --git a/themes/edx.org/lms/templates/dashboard.html b/themes/edx.org/lms/templates/dashboard.html index 96272a0849..19e8624fde 100644 --- a/themes/edx.org/lms/templates/dashboard.html +++ b/themes/edx.org/lms/templates/dashboard.html @@ -10,7 +10,7 @@ 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 Text, HTML +from openedx.core.djangolib.markup import HTML, Text %> <% From addb5bf6349001d7cd8044adbed07b6b22c97c59 Mon Sep 17 00:00:00 2001 From: Robert Raposa Date: Mon, 23 May 2016 09:00:32 -0400 Subject: [PATCH 2/2] Fix violations with n filter. --- lms/templates/api_admin/status.html | 2 +- lms/templates/dashboard.html | 4 ++-- lms/templates/edxnotes/edxnotes.html | 2 +- lms/templates/index.html | 2 +- themes/edx.org/lms/templates/dashboard.html | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lms/templates/api_admin/status.html b/lms/templates/api_admin/status.html index 0d84b753ce..c75939fb08 100644 --- a/lms/templates/api_admin/status.html +++ b/lms/templates/api_admin/status.html @@ -45,7 +45,7 @@ from openedx.core.djangolib.markup import HTML, Text
- ${form.as_p() | n} + ${form.as_p() | n, decode.utf8}
diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index a7123cfe9e..0ea4496170 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -63,13 +63,13 @@ from openedx.core.djangolib.markup import HTML, Text
%if message:
- ${message | n, unicode} + ${message | n, decode.utf8}
%endif %if enrollment_message:
- ${enrollment_message | n, unicode} + ${enrollment_message | n, decode.utf8}
%endif
diff --git a/lms/templates/edxnotes/edxnotes.html b/lms/templates/edxnotes/edxnotes.html index 688b832691..1f4bb51d6d 100644 --- a/lms/templates/edxnotes/edxnotes.html +++ b/lms/templates/edxnotes/edxnotes.html @@ -113,7 +113,7 @@ from openedx.core.djangolib.js_utils import dump_js_escaped_json, js_escaped_str <%static:require_module module_name="js/edxnotes/views/page_factory" class_name="NotesPageFactory"> NotesPageFactory({ disabledTabs: ${disabled_tabs | n, dump_js_escaped_json}, - notes: ${dump_js_escaped_json(notes, NoteJSONEncoder) | n}, + notes: ${dump_js_escaped_json(notes, NoteJSONEncoder) | n, decode.utf8}, notesEndpoint: ${notes_endpoint | n, dump_js_escaped_json}, pageSize: ${page_size | n, dump_js_escaped_json}, debugMode: ${debug | n, dump_js_escaped_json} diff --git a/lms/templates/index.html b/lms/templates/index.html index bcf7d48d10..fd2e2ec459 100644 --- a/lms/templates/index.html +++ b/lms/templates/index.html @@ -15,7 +15,7 @@ from openedx.core.djangolib.markup import HTML, Text
% if homepage_overlay_html: - ${homepage_overlay_html|n} + ${homepage_overlay_html | n, decode.utf8} % else: ## Translators: 'Open edX' is a registered trademark, please keep this untranslated. See http://open.edx.org for more information.

${Text(_(u"Welcome to the Open edX{registered_trademark} platform!")).format(registered_trademark=HTML("®"))}

diff --git a/themes/edx.org/lms/templates/dashboard.html b/themes/edx.org/lms/templates/dashboard.html index 19e8624fde..3410491a6b 100644 --- a/themes/edx.org/lms/templates/dashboard.html +++ b/themes/edx.org/lms/templates/dashboard.html @@ -65,13 +65,13 @@ from openedx.core.djangolib.markup import HTML, Text
%if message:
- ${message | n, unicode} + ${message | n, decode.utf8}
%endif %if enrollment_message:
- ${enrollment_message | n, unicode} + ${enrollment_message | n, decode.utf8}
%endif