[BD-14] "Source from Library" XBlock


An XBlock that lets you import a block from a blockstore-based content library into a (modulestore based) course, by copying the block into the course.

*Testing instructions*:

  • Start a blockstore server (run `make easyserver` in the [blockstore](https://github.com/edx/blockstore) directory.

  • Create some content in a blockstore-based content library. Note the IDs of a few blocks (e.g. lb:edX:test:html:1). Ideally use blocks that have children and static assets (such as images).
    This PR changes a blockstore based API, which is not part of the devstack yet. To test this:

  • Go into a course in Studio. In its advanced settings, add library_sourced to the list of advanced block types.

  • In the "Unit Edit View" in Studio, find the green "Add New Component" buttons. Click Advanced > Library Sourced Content.

  • Click the "Edit" button

  • Enter the Library XBlock ID you wish to import into the course

  • Press Save

  • You should now see the content has been copied into the course. Students won't see any trace of the "Library Sourced Content" block but instead will just see the imported block(s). Static assets such as images should be working correctly and will still be served from Blockstore.

To run tests:

  • From the blockstore directory, run `make testserver` to start a test-specific instance.

  • From `make studio-shell` run: `EDXAPP_RUN_BLOCKSTORE_TESTS=1 python -Wd -m pytest --ds=cms.envs.test common/lib/xmodule/xmodule/tests/test_library_tools.py`


  • [ ] @bradenmacdonald

  • [ ] edX reviewer[s] TBD

*Other notes*
> Note that once we get courses implemented in Blockstore as well I expect we won't use this block at all, so I haven't designed it to be forwards compatible in that sense. I expect that in Blockstore-based courses, the course outline will be a first-class object which can specify things like "Unit 15 should consist of these three blocks linked in from content library X, Unit 16 should have 2-5 XBlocks as returned by the adaptive engine, etc."

[Link](https://github.com/edx/edx-platform/pull/24323) to the WIP pull-request preceding this one.


David Ormsbee


Open Source Pull Request Bot

Github Latest Action by edX


Github PR Last Updated At

Jul 07, 2020, 4:06 PM

Github PR Last Updated By


Github Organization



PR Number




Contributor Name

Sid Verma

Github Latest Action

pull_request: unlabeled

Platform Map Area (Levels 1 & 2)

Educator Experiences - Content Blocks & interactives

Platform Map Area (Levels 3 & 4)


Blended Project Status Page