From 5e7920a89370663ae4ee3945bdfd96700a4a831a Mon Sep 17 00:00:00 2001 From: Pasi Sarolahti Date: Thu, 9 Mar 2023 21:57:23 +0200 Subject: [PATCH] Add RST validation for LTI 1.3 related directives --- access/course.py | 9 ++++++++- util/export.py | 9 +++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/access/course.py b/access/course.py index 8f16aa4..e6193cc 100644 --- a/access/course.py +++ b/access/course.py @@ -135,7 +135,7 @@ def load(exercise_key: str, course_dir: str, filename: str, lang: str) -> "Exerc class Parent(PydanticModel): - children: List[Union["Chapter", "Exercise", "LTIExercise", "ExerciseCollection"]] = [] + children: List[Union["Chapter", "Exercise", "LTIExercise", "LTI1p3Exercise", "ExerciseCollection"]] = [] def postprocess(self, **kwargs: Any): for c in self.children: @@ -317,6 +317,12 @@ class LTIExercise(Exercise): lti_open_in_iframe: NotRequired[bool] +class LTI1p3Exercise(Exercise): + lti1p3: str + lti_open_in_iframe: NotRequired[bool] + lti_custom: NotRequired[str] + + class ExerciseCollection(Item): target_category: str target_url: str @@ -344,6 +350,7 @@ def validate_static_content(cls, paths: Localized[Path]): Parent.update_forward_refs() Exercise.update_forward_refs() LTIExercise.update_forward_refs() +LTI1p3Exercise.update_forward_refs() ExerciseCollection.update_forward_refs() Chapter.update_forward_refs() diff --git a/util/export.py b/util/export.py index 8b3d89d..f0d9b11 100644 --- a/util/export.py +++ b/util/export.py @@ -82,6 +82,15 @@ def exercise( if k in exercise: of[k] = exercise[k] + if 'lti1p3' in exercise: + for k in ( + 'lti1p3', + 'lti_open_in_iframe', + 'lti_custom', + ): + if k in exercise: + of[k] = exercise[k] + if 'exercise_info' in exercise: of['exercise_info'] = exercise['exercise_info'] else: