class documentation
This class stores data in a folder hierarchy on disk.
Method | __init__ |
Initialise FileStorage. |
Method | delete |
Delete the course identified by course_title. Return a message in case of success. |
Method | delete |
Delete the learning content identified by learning_content_id. Return a message in case of success. |
Method | delete |
Attempt to delete the variant identified by variant_id. Return a message in case of success. |
Method | find |
Search for courses, and return a dict mapping their titles to their IDs, and IDs to titles. |
Method | get |
Return a list of titles of existing courses. |
Method | get |
Return a tuple (directory_name, html) with the name of the first directory found in the learning content, and the content of the first HTML file found in there. Both elements may be empty. |
Method | get |
Return the content of the first HTML file found in the learning content, or an empty string. |
Method | get |
Return the URI to the first image found in the learning content, or an empty string. |
Method | get |
Return a list of learning contents identifiers for a course in arbitrary order. |
Method | get |
Return a list of learning contents identifiers for a course in order. |
Method | get |
Return a dictionary mapping learning contents identifiers to their titles. |
Method | get |
Return the metadata of the variant as a dict. |
Method | get |
Return a list of all variants for a learning content in a course. |
Method | get |
Return a list of identifiers of all variants for a learning content in a course. |
Method | write |
Create a new course. Return a message indicating success or failure. |
Method | write |
Create a new learning content. Return a message indicating success or failure. |
Method | write |
Write an re-ordered list of learning contents into the course. Return a message indicating success or failure. |
Method | write |
Write a variant consisting of a single or multiple files, and create the according meta files. |
Inherited from Storage
:
Method | get |
Return an item from the course's cache as a dict. |
Method | get |
Return the metadata of the course as a dict. |
Return a tuple (directory_name, html) with the name of the first directory found in the learning content, and the content of the first HTML file found in there. Both elements may be empty.
Return the metadata of the variant as a dict. Example: { "identifier": "aa2835f3-c3e4-495a-bea8-3e283979e6e6", "format": "text/html", "type": "variant" }
Write an re-ordered list of learning contents into the course. Return a message indicating success or failure.