diff --git a/lti_consumer/api.py b/lti_consumer/api.py index 4a83181114aae4b601df33f61d681ace83dae163..462e9adb8d909f09a2ec0b43693a22a19cec7d78 100644 --- a/lti_consumer/api.py +++ b/lti_consumer/api.py @@ -4,6 +4,9 @@ Python APIs used to handle LTI configuration and launches. Some methods are meant to be used inside the XBlock, so they return plaintext to allow easy testing/mocking. """ + +import json + from .exceptions import LtiError from .models import LtiConfiguration, LtiDlContentItem from .utils import ( @@ -109,7 +112,7 @@ def get_lti_1p3_launch_info(config_id=None, block=None): 'oidc_callback': get_lms_lti_launch_link(), 'token_url': get_lms_lti_access_token_link(lti_config.location), 'deep_linking_launch_url': deep_linking_launch_url, - 'deep_linking_content_items': deep_linking_content_items, + 'deep_linking_content_items': json.dumps(deep_linking_content_items, indent=4), } diff --git a/lti_consumer/templates/html/lti_1p3_studio.html b/lti_consumer/templates/html/lti_1p3_studio.html index 820c378d573a9e31147d0c661da01dd931f65ffd..84d5702cc47c08ce9beb8687398612db75f5e18d 100644 --- a/lti_consumer/templates/html/lti_1p3_studio.html +++ b/lti_consumer/templates/html/lti_1p3_studio.html @@ -39,9 +39,7 @@ <b>{% trans "Deep Linking is configured on this tool." %}</b> {% trans "The Deep Linking configuration stored is presented below:" %} </p> - <code> - {{ deep_linking_content_items }} - </code> + <pre>{{ deep_linking_content_items }}</pre> <p> {% trans "If you run deep linking again, the content above will be replaced." %} diff --git a/lti_consumer/tests/unit/test_api.py b/lti_consumer/tests/unit/test_api.py index 64af91f08e07d2cd71cf4d2051d370444cce09d2..bf7b0de879ae4313c46338b44866fb2e1ef1332f 100644 --- a/lti_consumer/tests/unit/test_api.py +++ b/lti_consumer/tests/unit/test_api.py @@ -231,9 +231,9 @@ class TestGetLti1p3LaunchInfo(TestCase): lti_config.location ), 'deep_linking_launch_url': 'http://example.com', - 'deep_linking_content_items': [{ - "test": "this is a test attribute", - }] + + 'deep_linking_content_items': + '[\n {\n "test": "this is a test attribute"\n }\n]', } )