summaryrefslogtreecommitdiff
path: root/src/mailman/interfaces
diff options
context:
space:
mode:
authorJ08nY2017-06-01 20:53:53 +0200
committerJ08nY2017-08-07 17:39:07 +0200
commita665dccf9404d6f95d8a4587f05d748b504e1f9d (patch)
treea2bc4f3e4cbb443224d66a5cae4b78131b4e4213 /src/mailman/interfaces
parent1f1a35e7ccde1cfe239286a9a6333ebe8882d8f3 (diff)
downloadmailman-a665dccf9404d6f95d8a4587f05d748b504e1f9d.tar.gz
mailman-a665dccf9404d6f95d8a4587f05d748b504e1f9d.tar.zst
mailman-a665dccf9404d6f95d8a4587f05d748b504e1f9d.zip
Add REST-ability to plugins.
- Adds the rest_object method to the IPlugin interface. This method is called by the REST api to route requests to the plugin's REST api. All attributes are proxied, so the object becomes a true REST object in the ObjectRouter hierarchy. For example see the RESTExample and ExamplePlugin classes in mailman.testing.plugin. The plugin might return None from this method, in which case all calls to it's REST api route will return 404 NotFound. - Adds new routes to the REST api. For version >= 3.1: - /3.1/plugins Returns a dictionary with plugin names as keys, and their configs as values. - /3.1/plugins/<plugin_name> Proxies everything to plugin's rest_object, if plugin with such name exists and provides a non-null rest_object, else NotFound.
Diffstat (limited to 'src/mailman/interfaces')
-rw-r--r--src/mailman/interfaces/plugin.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mailman/interfaces/plugin.py b/src/mailman/interfaces/plugin.py
index 9e226824f..f1b7212f0 100644
--- a/src/mailman/interfaces/plugin.py
+++ b/src/mailman/interfaces/plugin.py
@@ -30,3 +30,9 @@ class IPlugin(Interface):
def post_hook():
"""A plugin hook called in the second initialization step. After DB."""
+
+ def rest_object():
+ """Return the REST object which will be hooked up to the REST api.
+
+ This object will be served at the /<api>/plugins/<plugin.name>/ root.
+ """