From cf4c985026ae557879424cfe7f87d488f7657649 Mon Sep 17 00:00:00 2001 From: Maria Fernanda Magallanes Zubillaga Date: Thu, 8 Jun 2023 22:37:59 -0500 Subject: [PATCH] feat: add explanation of patches --- docs/reference/index.rst | 2 +- .../{patches.rst => patches/catalog.rst} | 0 docs/reference/patches/index.rst | 26 +++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) rename docs/reference/{patches.rst => patches/catalog.rst} (100%) create mode 100644 docs/reference/patches/index.rst diff --git a/docs/reference/index.rst b/docs/reference/index.rst index 3281a9cf70b..e3ff8e4e763 100644 --- a/docs/reference/index.rst +++ b/docs/reference/index.rst @@ -6,6 +6,6 @@ Reference api/hooks/index api/hooks/catalog - patches + patches/index cli/index indexes diff --git a/docs/reference/patches.rst b/docs/reference/patches/catalog.rst similarity index 100% rename from docs/reference/patches.rst rename to docs/reference/patches/catalog.rst diff --git a/docs/reference/patches/index.rst b/docs/reference/patches/index.rst new file mode 100644 index 00000000000..ae7794ff8e4 --- /dev/null +++ b/docs/reference/patches/index.rst @@ -0,0 +1,26 @@ +========== +Patches +========== + +Patches are mechanisms that Tutor offers to plugin developers to modify the templates rendered to alter our environment. In many places, the Tutor templates include calls to ``{{ patch("patchname") }}``. Plugins can add content in these places with ``hooks.Filters.ENV_PATCHES.add_item``. + +Example:: + + from tutor import hooks + + hooks.Filters.ENV_PATCHES.add_item( + ( + "openedx-lms-common-settings", + "FEATURES['ALLOW_PUBLIC_ACCOUNT_CREATION'] = False" + ) + ) + +This will add ``FEATURES['ALLOW_PUBLIC_ACCOUNT_CREATION'] = False`` to the lms common settings with a Python Tutor plugin. + +.. note:: If you want a Package Tutor plugin, we recommend you to use the `overhangio/cookiecutter-tutor-plugin `_ and add in the patches directory a file with the name of the patch, and inside the file add the content you want to add to the templates that use that patch. + +You can find a list of all patches used across Tutor here: +.. toctree:: + :maxdepth: 1 + + catalog \ No newline at end of file