mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-11-17 02:25:10 +00:00
71ed7a8618
The hooks API had several issues which are summarized in this comment: https://github.com/openedx/wg-developer-experience/issues/125#issuecomment-1313553526 1. "consts" was a bad name 2. "hooks.filters" and "hooks.Filters" could easily be confused 3. docs made it difficult to understand that plugin developers should use the catalog To address these issues, we: 1. move "consts.py" to "catalog.py" 2. Remove "hooks.actions", "hooks.filters", "hooks.contexts" from the API. 3. re-organize the docs and give better usage examples in the catalog. This change is a partial fix for https://github.com/openedx/wg-developer-experience/issues/125
1.1 KiB
1.1 KiB
- 💥[Feature] Simplify the hooks API. Plugin developers who were previously using
hooks.actions
,hooks.filters
orhooks.contexts
should now import these modules explicitely. (by @regisb) - 💥[Feature] Simplify the hooks API. The modules
tutor.hooks.actions
,tutor.hooks.filters
, andtutor.hooks.contexts
are no longer part of the API. This change should affect mosst developers, who only use theActions
andFilters
classes (notice the plural) fromtutor.hooks
. (by @regisb)- Instead of
tutor.hooks.actions.get("some:action")
, usetutor.hooks.Actions.SOME_ACTION
. - Instead of
tutor.hooks.filters.get("some:filter")
, usetutor.hooks.Filters.SOME_FILTER
. - Instead of
tutor.hooks.actions.add("some:action")
, usetutor.hooks.Actions.SOME_ACTION.add()
. The same applies to thedo
method. - Instead of
tutor.hooks.filters.add("some:filter")
, usetutor.hooks.Filters.SOME_FILTER.add()
. The same applies to theadd_item
,add_items
,apply
, anditerate
methods. - Instead of
tutor.hooks.contexts.enter
, usetutor.core.hooks.contexts.enter
.
- Instead of