Skip to content

Commit cf4c985

Browse files
committed
feat: add explanation of patches
1 parent fb15f21 commit cf4c985

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

docs/reference/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Reference
66

77
api/hooks/index
88
api/hooks/catalog
9-
patches
9+
patches/index
1010
cli/index
1111
indexes
File renamed without changes.

docs/reference/patches/index.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
==========
2+
Patches
3+
==========
4+
5+
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``.
6+
7+
Example::
8+
9+
from tutor import hooks
10+
11+
hooks.Filters.ENV_PATCHES.add_item(
12+
(
13+
"openedx-lms-common-settings",
14+
"FEATURES['ALLOW_PUBLIC_ACCOUNT_CREATION'] = False"
15+
)
16+
)
17+
18+
This will add ``FEATURES['ALLOW_PUBLIC_ACCOUNT_CREATION'] = False`` to the lms common settings with a Python Tutor plugin.
19+
20+
.. note:: If you want a Package Tutor plugin, we recommend you to use the `overhangio/cookiecutter-tutor-plugin <https://github.com/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.
21+
22+
You can find a list of all patches used across Tutor here:
23+
.. toctree::
24+
:maxdepth: 1
25+
26+
catalog

0 commit comments

Comments
 (0)