Support for storing an XBlock's static asset files in Blockstore
This PR introduces some backend python + REST APIs for storing static asset files along with an XBlock in a content library. It also updates the new runtime to be able to load such static asset files. Example use cases: * Store an image file with an HTML block and then use the image inline in the HTML block. * Store a PDF file with an HTML block and provide a link in the HTML for the learner to download the PDF. * Store .srt files or even video .mp4 files that belong to a video XBlock. Within the bundle, these static asset files are stored in a "static/" subfolder of the folder that contains the OLX file. Extending an existing LMS/Studio convention, a static asset file such as "image.png" is referenced within the OLX as "/static/image.png" and the URL will be rewritten by the runtime.
Showing
- openedx/core/djangoapps/content_libraries/api.py 110 additions, 15 deletionsopenedx/core/djangoapps/content_libraries/api.py
- openedx/core/djangoapps/content_libraries/library_bundle.py 28 additions, 0 deletionsopenedx/core/djangoapps/content_libraries/library_bundle.py
- openedx/core/djangoapps/content_libraries/serializers.py 34 additions, 0 deletionsopenedx/core/djangoapps/content_libraries/serializers.py
- openedx/core/djangoapps/content_libraries/tests/base.py 204 additions, 0 deletionsopenedx/core/djangoapps/content_libraries/tests/base.py
- openedx/core/djangoapps/content_libraries/tests/test_content_libraries.py 3 additions, 135 deletions...ngoapps/content_libraries/tests/test_content_libraries.py
- openedx/core/djangoapps/content_libraries/tests/test_runtime.py 5 additions, 5 deletions...x/core/djangoapps/content_libraries/tests/test_runtime.py
- openedx/core/djangoapps/content_libraries/tests/test_static_assets.py 113 additions, 0 deletions.../djangoapps/content_libraries/tests/test_static_assets.py
- openedx/core/djangoapps/content_libraries/urls.py 4 additions, 3 deletionsopenedx/core/djangoapps/content_libraries/urls.py
- openedx/core/djangoapps/content_libraries/views.py 74 additions, 2 deletionsopenedx/core/djangoapps/content_libraries/views.py
- openedx/core/djangoapps/xblock/runtime/blockstore_runtime.py 41 additions, 4 deletionsopenedx/core/djangoapps/xblock/runtime/blockstore_runtime.py
- openedx/core/djangoapps/xblock/runtime/runtime.py 54 additions, 1 deletionopenedx/core/djangoapps/xblock/runtime/runtime.py
- openedx/core/djangoapps/xblock/runtime/shims.py 16 additions, 9 deletionsopenedx/core/djangoapps/xblock/runtime/shims.py
- openedx/core/djangoapps/xblock/tests/README.rst 8 additions, 0 deletionsopenedx/core/djangoapps/xblock/tests/README.rst
- openedx/core/lib/blockstore_api/__init__.py 2 additions, 0 deletionsopenedx/core/lib/blockstore_api/__init__.py
- openedx/core/lib/blockstore_api/methods.py 17 additions, 0 deletionsopenedx/core/lib/blockstore_api/methods.py
Please register or sign in to comment