Files
edx-platform/cms/lib/xblock/runtime.py
Waheed Ahmed a23a31c2be Allow Block Structures Collect to work in Studio.
The collect process was broken before this commit because Studio's
runtime does not permit handler_url invocation on "thirdparty"
XBlocks.

PROD-1393
2020-03-30 13:24:34 +05:00

31 lines
656 B
Python

"""
XBlock runtime implementations for edX Studio
"""
import logging
import six
from django.urls import reverse
log = logging.getLogger(__name__)
def handler_url(block, handler_name, suffix='', query='', thirdparty=False):
"""
Handler URL function for Studio
"""
if thirdparty:
log.warning("edX Studio doesn't support third-party handler urls for XBlock %s", type(block))
url = reverse('component_handler', kwargs={
'usage_key_string': six.text_type(block.scope_ids.usage_id),
'handler': handler_name,
'suffix': suffix,
}).rstrip('/')
if query:
url += '?' + query
return url