Skip to content

Commit

Permalink
WIP new plugin loader, plugin guide
Browse files Browse the repository at this point in the history
  • Loading branch information
rafalp committed Nov 18, 2023
1 parent 25daa38 commit 4ecaeb6
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 4 deletions.
1 change: 0 additions & 1 deletion dev
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ bootstrap_plugins() {
else
echo "Skipping plugin bootstrap because plugins directory doesn't exist."
fi
exit 1
}

# Clear existing dev project
Expand Down
7 changes: 7 additions & 0 deletions dev-docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ This directory contains reference documents for Misago developers.
Misago's notifications feature is implemented in the `misago.notifications` package.

- [Notifications reference](./notifications.md)


## Plugins

Misago implements a plugin system that extends [Django's existing application mechanism](https://docs.djangoproject.com/en/4.2/ref/applications/), allowing developers to customize and extend standard features.

- [Plugin guide](./plugins/index.md)
1 change: 1 addition & 0 deletions dev-docs/plugins/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Plugin guide
4 changes: 2 additions & 2 deletions devproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import os

from misago import load_plugin_list_if_exists
from misago import plugin_loader
from misago.settings import *


Expand Down Expand Up @@ -160,7 +160,7 @@

PLUGINS_LIST_PATH = os.path.join(os.path.dirname(BASE_DIR), "plugins.txt")

INSTALLED_PLUGINS = load_plugin_list_if_exists(PLUGINS_LIST_PATH) or []
INSTALLED_PLUGINS = plugin_loader.get_plugins_apps()

# Combine Misago's default installed apps with plugins
INSTALLED_APPS = [
Expand Down
2 changes: 1 addition & 1 deletion misago/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .plugins.pluginlist import load_plugin_list_if_exists
from .plugins.loader import plugin_loader


__version__ = "0.39.0"
Expand Down
26 changes: 26 additions & 0 deletions misago/plugins/loader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os


PLUGINS_DIR = os.environ.get("MISAGO_PLUGINS") or None


class PluginLoader:
def __init__(self):
pass

def load_plugins(self):
pass

def get_plugins_manifests(self):
pass

def get_plugins_apps(self):
pass


plugin_loader = PluginLoader()

if PLUGINS_DIR:
plugins_dir = os.path(PLUGINS_DIR)
if plugins_dir.isdir():
plugin_loader.load_plugins(plugins_dir)

0 comments on commit 4ecaeb6

Please sign in to comment.