-
Notifications
You must be signed in to change notification settings - Fork 27
Description
The how-to for receiving events documents two options (see https://github.com/openedx/openedx-events/blame/main/docs/how-tos/using-events.rst#L10-L53).
- Connecting signals using regular django syntax, and
- Connecting signals using apps.py plugin configuration.
Please help me check my understanding. Is the following accurate?
I believe that the second option, using apps.py plugin configuration, pre-dates the use of openedx-events. In the earliest version of plugins, they needed to reach into a signal definition that was defined in edx-platform (as an example), and was not exposed to the plugin. Now that openedx-events signals exist, the signal can instead be imported from openedx-events, and regular django syntax can be used. In fact, the earlier mechanism of using apps.py should probably be deprecated, in favor of transitioning any necessary signals to an openedx-event.
Inside edx-platform, there are many uses of apps.py to listen to signals. See https://github.com/search?q=repo%3Aopenedx%2Fedx-platform+plugin_app&type=code. I find this very confusing, because it is using "plugin" syntax for non-plugin apps that live inside the repo. Is there any good reason to do this, or is this just a lot of copy/paste of something that doesn't make as much sense?
One proposal is to deprecate the apps.py plugin way of listening to signals. If the signal is an OpenedxSignal, then the warning could simply ask to refactor to use simple django syntax. Otherwise, the deprecation warning could note that the simple django syntax should be accessible for any signal inside the same repo, or if this is truly for a plugin, then a new signal should be added to openedx-events to expose the event.
Thoughts?