diff --git a/common/djangoapps/edxmako/middleware.py b/common/djangoapps/edxmako/middleware.py index cb67e2f142..e5268b4f55 100644 --- a/common/djangoapps/edxmako/middleware.py +++ b/common/djangoapps/edxmako/middleware.py @@ -19,6 +19,8 @@ from django.template.context import _builtin_context_processors from django.utils.module_loading import import_string from util.request import safe_get_host +from request_cache.middleware import RequestCache + REQUEST_CONTEXT = threading.local() @@ -51,6 +53,12 @@ def get_template_request_context(): request = getattr(REQUEST_CONTEXT, "request", None) if not request: return None + + request_cache_dict = RequestCache.get_request_cache().data + cache_key = "edxmako_request_context" + if cache_key in request_cache_dict: + return request_cache_dict[cache_key] + context = RequestContext(request) context['is_secure'] = request.is_secure() context['site'] = safe_get_host(request) @@ -62,4 +70,6 @@ def get_template_request_context(): for processor in get_template_context_processors(): context.update(processor(request)) + request_cache_dict[cache_key] = context + return context diff --git a/common/djangoapps/edxmako/shortcuts.py b/common/djangoapps/edxmako/shortcuts.py index aaa60f465d..da5ddfe3cd 100644 --- a/common/djangoapps/edxmako/shortcuts.py +++ b/common/djangoapps/edxmako/shortcuts.py @@ -33,7 +33,6 @@ def marketing_link(name): possible URLs for certain links. This function is to decides which URL should be provided. """ - # link_map maps URLs from the marketing site to the old equivalent on # the Django site link_map = settings.MKTG_URL_LINK_MAP diff --git a/common/lib/xmodule/xmodule/capa_base.py b/common/lib/xmodule/xmodule/capa_base.py index 64e9729c2a..0eb1241de9 100644 --- a/common/lib/xmodule/xmodule/capa_base.py +++ b/common/lib/xmodule/xmodule/capa_base.py @@ -399,6 +399,7 @@ class CapaMixin(CapaFields): 'ajax_url': self.runtime.ajax_url, 'progress_status': Progress.to_js_status_str(progress), 'progress_detail': Progress.to_js_detail_str(progress), + 'content': self.get_problem_html(encapsulate=False) }) def check_button_name(self): diff --git a/common/lib/xmodule/xmodule/js/src/capa/display.coffee b/common/lib/xmodule/xmodule/js/src/capa/display.coffee index ecd85d9226..524b33778e 100644 --- a/common/lib/xmodule/xmodule/js/src/capa/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/capa/display.coffee @@ -5,6 +5,7 @@ class @Problem @id = @el.data('problem-id') @element_id = @el.attr('id') @url = @el.data('url') + @content = @el.data('content') # has_timed_out and has_response are used to ensure that are used to # ensure that we wait a minimum of ~ 1s before transitioning the check @@ -12,7 +13,7 @@ class @Problem @has_timed_out = false @has_response = false - @render() + @render(@content) $: (selector) -> $(selector, @el) diff --git a/lms/templates/problem_ajax.html b/lms/templates/problem_ajax.html index 05c3c2ada8..664b7567c0 100644 --- a/lms/templates/problem_ajax.html +++ b/lms/templates/problem_ajax.html @@ -1 +1 @@ -
+