From 569c5def77ddb392cedf2336d1df015b7a4cf641 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 4 Feb 2014 11:44:42 -0500 Subject: [PATCH] Make uses of quote_slashes always operate on encoded strings --- cms/lib/xblock/runtime.py | 2 +- common/djangoapps/xmodule_modifiers.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cms/lib/xblock/runtime.py b/cms/lib/xblock/runtime.py index 36437c4750..e0e2491028 100644 --- a/cms/lib/xblock/runtime.py +++ b/cms/lib/xblock/runtime.py @@ -16,7 +16,7 @@ def handler_url(block, handler_name, suffix='', query='', thirdparty=False): raise NotImplementedError("edX Studio doesn't support third-party xblock handler urls") url = reverse('component_handler', kwargs={ - 'usage_id': quote_slashes(str(block.scope_ids.usage_id)), + 'usage_id': quote_slashes(unicode(block.scope_ids.usage_id).encode('utf-8')), 'handler': handler_name, 'suffix': suffix, }).rstrip('/') diff --git a/common/djangoapps/xmodule_modifiers.py b/common/djangoapps/xmodule_modifiers.py index 1b095bf917..f8e51b7733 100644 --- a/common/djangoapps/xmodule_modifiers.py +++ b/common/djangoapps/xmodule_modifiers.py @@ -71,12 +71,12 @@ 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(str(block.scope_ids.usage_id)) + data['usage-id'] = quote_slashes(unicode(block.scope_ids.usage_id).encode('utf-8')) template_context = { 'content': block.display_name if display_name_only else frag.content, 'classes': css_classes, - 'data_attributes': ' '.join('data-{}="{}"'.format(key, value) for key, value in data.items()), + 'data_attributes': ' '.join(u'data-{}="{}"'.format(key, value) for key, value in data.items()), } return wrap_fragment(frag, render_to_string('xblock_wrapper.html', template_context))