From 3ecbbd6055fd27178513f6a840ce629fd7c063b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9D=D1=94=D0=B4=D1=94=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=96=D1=86=D0=B5=D0=B2?= Date: Mon, 8 Apr 2024 15:20:04 +0300 Subject: [PATCH] style: [AXIMST-28] fix pylint issues --- cms/djangoapps/contentstore/views/block.py | 30 +++++++--------------- cms/templates/container_editor.html | 1 - cms/urls.py | 2 +- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/cms/djangoapps/contentstore/views/block.py b/cms/djangoapps/contentstore/views/block.py index 6e4302ae94ec..ea2d1c437c5c 100644 --- a/cms/djangoapps/contentstore/views/block.py +++ b/cms/djangoapps/contentstore/views/block.py @@ -14,7 +14,7 @@ from web_fragments.fragment import Fragment from cms.lib.xblock.authoring_mixin import VISIBILITY_VIEW -from common.djangoapps.edxmako.shortcuts import render_to_string +from common.djangoapps.edxmako.shortcuts import render_to_response, render_to_string from common.djangoapps.student.auth import ( has_studio_read_access, has_studio_write_access, @@ -299,15 +299,17 @@ def xblock_view_handler(request, usage_key_string, view_name): else: return HttpResponse(status=406) -from common.djangoapps.edxmako.shortcuts import render_to_response + @require_http_methods("GET") @login_required -def partial_edit_view_xblock(request,usage_key_string): +def partial_edit_view_xblock(request, usage_key_string): + """ + The restful handler for requests for rendered xblock views. + """ usage_key = usage_key_with_run(usage_key_string) if not has_studio_read_access(request.user, usage_key.course_key): raise PermissionDenied() - store = modulestore() xblock = store.get_item(usage_key) @@ -332,7 +334,6 @@ def partial_edit_view_xblock(request,usage_key_string): ) ) - load_services_for_studio(xblock.runtime, request.user) # try: @@ -354,8 +355,7 @@ def partial_edit_view_xblock(request,usage_key_string): # 'reorderable_container_child_preview' is only rendered for xblocks that # are being shown in a reorderable container, so the xblock is automatically # added to the list. - reorderable_items = set() - + # reorderable_items = set() force_render = request.GET.get("force_render", None) @@ -398,21 +398,9 @@ def partial_edit_view_xblock(request,usage_key_string): }, ) + from ..utils import get_container_handler_context # pylint: disable=import-outside-toplevel + from .component import _get_item_in_course # pylint: disable=import-outside-toplevel - fragment_content = studio_fragment.content - if isinstance(fragment_content, bytes): - fragment_content = studio_fragment.content.decode("utf-8") - - context = { - "studio_fragment": studio_fragment, - "wrapper_fragment": wrapper_fragment, - "is_learning_mfe":True - - } - - from ..utils import get_container_handler_context - from .component import _get_item_in_course - # return render_to_response('courseware-chromeless.html', context) usage_key = usage_key_with_run(usage_key_string) with modulestore().bulk_operations(usage_key.course_key): course, xblock, lms_link, preview_lms_link = _get_item_in_course(request, usage_key) diff --git a/cms/templates/container_editor.html b/cms/templates/container_editor.html index 6f1345e1a7a7..a5afa5125e62 100644 --- a/cms/templates/container_editor.html +++ b/cms/templates/container_editor.html @@ -18,7 +18,6 @@ from openedx.core.djangolib.markup import HTML from openedx.core.release import RELEASE_LINE %> -<%page expression_filter="h"/> <%def name="online_help_token()"> <% return "container" diff --git a/cms/urls.py b/cms/urls.py index 36ee3b5fec67..811f78e620eb 100644 --- a/cms/urls.py +++ b/cms/urls.py @@ -147,7 +147,7 @@ re_path(fr'^xblock/container/{settings.USAGE_KEY_PATTERN}$', contentstore_views.xblock_container_handler, name='xblock_container_handler'), re_path(fr'^xblock/{settings.USAGE_KEY_PATTERN}/editor$', partial_edit_view_xblock, - name='xblock_editor_handler'), + name='xblock_editor_handler'), re_path(fr'^xblock/{settings.USAGE_KEY_PATTERN}/(?P[^/]+)$', contentstore_views.xblock_view_handler, name='xblock_view_handler'), re_path(fr'^xblock/{settings.USAGE_KEY_PATTERN}?$', contentstore_views.xblock_handler,