Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add explanation of patches #852

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ Reference

api/hooks/index
api/hooks/catalog
patches
patches/index
cli/index
indexes
File renamed without changes.
27 changes: 27 additions & 0 deletions docs/reference/patches/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
==========
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 <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.

You can find a list of all patches used across Tutor here:

.. toctree::
:maxdepth: 1

catalog