Contains the currently-in-development project by HarvardX to bring the annotation tool currently living in the edX platform to a more accessible LTI implementation.
This PR ensures that the image annotation UI doesn't break if the IIIF manifest can't be retrieved or parsed.
By default, the tool will retrieve the manifest and extract the ID of the image that should be displayed in Mirador (i.e. the canvas ID). The problem is that if the request fails (e.g. HTTP 404, 500), then it will raise a JSONDecodeError which is shown to the user as a generic Internal Server Error. This PR fixes that so any errors are caught when retrieving/parsing the manifest.
Changes:
Refactored get_canvas_id_for_mirador() method to simplify the logic and ensure that any errors in the request, parsing, or extraction phases are handled.
Added basic pytest tests to ensure this is the actual behavior.
Annotated the AssignmentTargets model to describe the content of the target_external_options field, which was being used in get_canvas_id_for_mirador() to determine whether a canvas_id was already configured or if a request to the manifest needed to be made.
This PR ensures that the image annotation UI doesn't break if the IIIF manifest can't be retrieved or parsed.
By default, the tool will retrieve the manifest and extract the ID of the image that should be displayed in Mirador (i.e. the canvas ID). The problem is that if the request fails (e.g. HTTP 404, 500), then it will raise a
JSONDecodeError
which is shown to the user as a generic Internal Server Error. This PR fixes that so any errors are caught when retrieving/parsing the manifest.Changes:
get_canvas_id_for_mirador()
method to simplify the logic and ensure that any errors in the request, parsing, or extraction phases are handled.pytest
tests to ensure this is the actual behavior.AssignmentTargets
model to describe the content of thetarget_external_options
field, which was being used inget_canvas_id_for_mirador()
to determine whether acanvas_id
was already configured or if a request to the manifest needed to be made.@lduarte1991