@@ -5,7 +5,7 @@
|
|||||||
import hashlib
|
import hashlib
|
||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
hlskey = hashlib.md5(module.location.url()).hexdigest()
|
hlskey = hashlib.md5(module.location.url().encode('utf-8')).hexdigest()
|
||||||
%>
|
%>
|
||||||
|
|
||||||
## js templates
|
## js templates
|
||||||
|
|||||||
@@ -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.
|
# include the secret key as a salt, and to make the ids unique across different LMS installs.
|
||||||
hasher = hashlib.md5()
|
hasher = hashlib.md5()
|
||||||
hasher.update(settings.SECRET_KEY)
|
hasher.update(settings.SECRET_KEY)
|
||||||
hasher.update(str(user.id))
|
hasher.update(unicode(user.id))
|
||||||
hasher.update(course_id)
|
hasher.update(course_id.encode('utf-8'))
|
||||||
digest = hasher.hexdigest()
|
digest = hasher.hexdigest()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ def wrap_xblock(runtime_class, block, view, frag, context, display_name_only=Fal
|
|||||||
data['runtime-class'] = runtime_class
|
data['runtime-class'] = runtime_class
|
||||||
data['runtime-version'] = frag.js_init_version
|
data['runtime-version'] = frag.js_init_version
|
||||||
data['block-type'] = block.scope_ids.block_type
|
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 = {
|
template_context = {
|
||||||
'content': block.display_name if display_name_only else frag.content,
|
'content': block.display_name if display_name_only else frag.content,
|
||||||
'classes': css_classes,
|
'classes': css_classes,
|
||||||
'display_name': block.display_name_with_default,
|
'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))
|
return wrap_fragment(frag, render_to_string('xblock_wrapper.html', template_context))
|
||||||
|
|||||||
@@ -129,7 +129,7 @@
|
|||||||
</html>
|
</html>
|
||||||
|
|
||||||
<%def name="login_query()">${
|
<%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(course_id),
|
||||||
html.escape(enrollment_action)
|
html.escape(enrollment_action)
|
||||||
) if course_id and enrollment_action else ""
|
) if course_id and enrollment_action else ""
|
||||||
|
|||||||
Reference in New Issue
Block a user