diff --git a/xblocks_contrib/problem/capa/apps.py b/xblocks_contrib/problem/capa/apps.py index 11a253d6..e3373de2 100644 --- a/xblocks_contrib/problem/capa/apps.py +++ b/xblocks_contrib/problem/capa/apps.py @@ -10,7 +10,7 @@ class CapaAppConfig(AppConfig): Configuration for the CAPA problem XBlock Django application. Why are we registering this as a Django App? - ------------------------------------------- + -------------------------------------------- By default, Django's template engine (specifically the `app_directories` loader) only discovers `templates/` folders that belong to an app listed in `INSTALLED_APPS`. @@ -28,10 +28,13 @@ class CapaAppConfig(AppConfig): without manual intervention. References: + - Open edX Plugin App Framework: https://docs.openedx.org/projects/edx-django-utils/en/latest/plugins/how_tos/how_to_create_a_plugin_app.html + - Django App Directories Loader: https://docs.djangoproject.com/en/stable/ref/templates/api/#django.template.loaders.app_directories.Loader + """ name = "xblocks_contrib.problem.capa" diff --git a/xblocks_contrib/problem/capa/capa_problem.py b/xblocks_contrib/problem/capa/capa_problem.py index 7f7c1216..1329a747 100644 --- a/xblocks_contrib/problem/capa/capa_problem.py +++ b/xblocks_contrib/problem/capa/capa_problem.py @@ -81,7 +81,7 @@ # main class for this module -class LoncapaSystem: # pylint: disable=too-few-public-methods,too-many-instance-attributes +class LoncapaSystem: """ An encapsulation of resources needed from the outside. @@ -127,7 +127,7 @@ def __init__( # pylint: disable=too-many-positional-arguments,too-many-argument self.matlab_api_key = matlab_api_key -class LoncapaProblem: # pylint: disable=too-many-public-methods,too-many-instance-attributes +class LoncapaProblem: """ Main class for capa Problems. """ @@ -239,7 +239,7 @@ def __init__( # pylint: disable=too-many-positional-arguments,too-many-argument # Run response late_transforms last (see MultipleChoiceResponse) # Sort the responses to be in *_1 *_2 ... order. responses = list(self.responders.values()) - responses = sorted(responses, key=lambda resp: int(resp.id[resp.id.rindex("_") + 1 :])) + responses = sorted(responses, key=lambda resp: int(resp.id[resp.id.rindex("_") + 1:])) for response in responses: if hasattr(response, "late_transforms"): response.late_transforms(self) @@ -251,21 +251,35 @@ def make_xml_compatible(self, tree): """ Adjust tree xml in-place for compatibility before creating a problem from it. + The idea here is to provide a central point for XML translation, for example, supporting an old XML format. At present, there just two translations. 1. compatibility translation: - old: ANSWER - convert to - new: OPTIONAL-HINT + + old:: + + ANSWER + + convert to + + new:: + + OPTIONAL-HINT 2. compatibility translation: - optioninput works like this internally: - - With extended hints there is a new - This translation takes in the new format and synthesizes the old option= attribute - so all downstream logic works unchanged with the new