feat!: remove block handling from runtime initialization of ReplaceURLService

BREAKING CHANGE: This removes the following deprecated shims from the runtime:
`replace_urls`, `replace_course_urls`, `replace_jump_to_id_urls`. XBlocks need
to use the `replace_urls` service instead.
This commit is contained in:
Agrendalath
2023-06-05 16:31:22 +02:00
committed by Piotr Surowiec
parent a903230a74
commit 71fee4a4a0
9 changed files with 70 additions and 147 deletions

View File

@@ -11,7 +11,6 @@ from django.utils.functional import cached_property
from fs.memoryfs import MemoryFS
from common.djangoapps.edxmako.shortcuts import render_to_string
from common.djangoapps.static_replace.services import ReplaceURLService
from common.djangoapps.student.models import anonymous_id_for_user
from openedx.core.djangoapps.xblock.apps import get_xblock_app_config
@@ -162,39 +161,6 @@ class RuntimeShim:
# as part of the runtime.
raise NotImplementedError("This newer runtime does not support process_xml()")
def replace_urls(self, html_str):
"""
Deprecated in favor of the replace_urls service.
"""
warnings.warn(
'replace_urls is deprecated. Please use ReplaceURLService instead.',
DeprecationWarning, stacklevel=3,
)
return ReplaceURLService(
xblock=self._active_block,
lookup_asset_url=self._lookup_asset_url
).replace_urls(html_str)
def replace_course_urls(self, html_str):
"""
Deprecated in favor of the replace_urls service.
"""
warnings.warn(
'replace_course_urls is deprecated. Please use ReplaceURLService instead.',
DeprecationWarning, stacklevel=3,
)
return html_str
def replace_jump_to_id_urls(self, html_str):
"""
Deprecated in favor of the replace_urls service.
"""
warnings.warn(
'replace_jump_to_id_urls is deprecated. Please use ReplaceURLService instead.',
DeprecationWarning, stacklevel=3,
)
return html_str
@property
def resources_fs(self):
"""