diff --git a/cms/templates/widgets/metadata-edit.html b/cms/templates/widgets/metadata-edit.html index ac904262c3..74c5ac968e 100644 --- a/cms/templates/widgets/metadata-edit.html +++ b/cms/templates/widgets/metadata-edit.html @@ -5,7 +5,7 @@ import hashlib import copy import json - hlskey = hashlib.md5(module.location.url()).hexdigest() + hlskey = hashlib.md5(module.location.url().encode('utf-8')).hexdigest() %> ## js templates diff --git a/common/djangoapps/student/models.py b/common/djangoapps/student/models.py index e5017dab23..d691b35e5a 100644 --- a/common/djangoapps/student/models.py +++ b/common/djangoapps/student/models.py @@ -82,8 +82,8 @@ def anonymous_id_for_user(user, course_id): # include the secret key as a salt, and to make the ids unique across different LMS installs. hasher = hashlib.md5() hasher.update(settings.SECRET_KEY) - hasher.update(str(user.id)) - hasher.update(course_id) + hasher.update(unicode(user.id)) + hasher.update(course_id.encode('utf-8')) digest = hasher.hexdigest() try: diff --git a/common/djangoapps/xmodule_modifiers.py b/common/djangoapps/xmodule_modifiers.py index 21fb55c460..55160f766f 100644 --- a/common/djangoapps/xmodule_modifiers.py +++ b/common/djangoapps/xmodule_modifiers.py @@ -72,13 +72,13 @@ def wrap_xblock(runtime_class, block, view, frag, context, display_name_only=Fal data['runtime-class'] = runtime_class data['runtime-version'] = frag.js_init_version data['block-type'] = block.scope_ids.block_type - data['usage-id'] = quote_slashes(unicode(block.scope_ids.usage_id).encode('utf-8')) + data['usage-id'] = quote_slashes(unicode(block.scope_ids.usage_id)) template_context = { 'content': block.display_name if display_name_only else frag.content, 'classes': css_classes, 'display_name': block.display_name_with_default, - 'data_attributes': ' '.join(u'data-{}="{}"'.format(key, value) for key, value in data.items()), + 'data_attributes': u' '.join(u'data-{}="{}"'.format(key, value) for key, value in data.items()), } return wrap_fragment(frag, render_to_string('xblock_wrapper.html', template_context)) diff --git a/lms/templates/main.html b/lms/templates/main.html index 4784bb6e65..7b1d23f224 100644 --- a/lms/templates/main.html +++ b/lms/templates/main.html @@ -129,7 +129,7 @@ <%def name="login_query()">${ - "?course_id={0}&enrollment_action={1}".format( + u"?course_id={0}&enrollment_action={1}".format( html.escape(course_id), html.escape(enrollment_action) ) if course_id and enrollment_action else ""