Skip to content

Commit

Permalink
fix: remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
navinkarkera committed Oct 18, 2024
1 parent 4f8b4db commit ddd1307
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 44 deletions.
37 changes: 1 addition & 36 deletions cms/djangoapps/contentstore/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from django.contrib.auth import get_user_model
from django.utils.translation import gettext as _
from opaque_keys.edx.keys import AssetKey, CourseKey, UsageKey
from opaque_keys.edx.locator import DefinitionLocator, LibraryUsageLocatorV2, LocalId
from opaque_keys.edx.locator import DefinitionLocator, LocalId
from xblock.core import XBlock
from xblock.fields import ScopeIds
from xblock.runtime import IdGenerator
Expand Down Expand Up @@ -305,41 +305,6 @@ def import_staged_content_from_user_clipboard(parent_key: UsageKey, request) ->
return new_xblock, notices


def import_from_library_content(parent_key: UsageKey, content_key: LibraryUsageLocatorV2, request) -> XBlock:
"""
Import a block (along with its children) from a library content block.
Does not deal with permissions or REST stuff - do that before calling this.
"""

from cms.djangoapps.contentstore.views.preview import _load_preview_block
from openedx.core.djangoapps.content_libraries import api as library_api
from openedx.core.lib.xblock_serializer.api import serialize_xblock_to_olx
import openedx.core.djangoapps.xblock.api as xblock_api

library_component = library_api.get_library_block(content_key)
xblock = xblock_api.load_block(content_key, user=request.user)

xblock_data = serialize_xblock_to_olx(xblock)
node = etree.fromstring(xblock_data.olx_str)
store = modulestore()
with store.bulk_operations(parent_key.course_key):
parent_descriptor = store.get_item(parent_key)
# Some blocks like drag-and-drop only work here with the full XBlock runtime loaded:
parent_xblock = _load_preview_block(request, parent_descriptor)
new_xblock = _import_xml_node_to_parent(
node,
parent_xblock,
store,
user=request.user,
slug_hint=content_key.block_id,
copied_from_block=str(content_key),
copied_from_version_num=library_component.published_version_num,
tags=xblock_data.tags,
)
return new_xblock


def _import_xml_node_to_parent(
node,
parent_xblock: XBlock,
Expand Down
6 changes: 0 additions & 6 deletions cms/djangoapps/contentstore/views/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,12 +432,6 @@ def create_support_legend_dict():
if advanced_component_templates['templates']:
component_templates.insert(0, advanced_component_templates)

# component_templates.append({
# "type": "abc",
# "templates": "abc",
# "display_name": "ABC",
# "support_legend": create_support_legend_dict()
# })
return component_templates


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
)
from edx_proctoring.exceptions import ProctoredExamNotFoundException
from help_tokens.core import HelpUrlExpert
from opaque_keys.edx.locator import LibraryUsageLocator, LibraryUsageLocatorV2
from opaque_keys.edx.locator import LibraryUsageLocator
from pytz import UTC
from xblock.core import XBlock
from xblock.fields import Scope
Expand Down Expand Up @@ -77,7 +77,6 @@
from .create_xblock import create_xblock
from .xblock_helpers import usage_key_with_run
from ..helpers import (
import_from_library_content,
get_parent_xblock,
import_staged_content_from_user_clipboard,
is_unit,
Expand Down

0 comments on commit ddd1307

Please sign in to comment.