feature/migrations, closes #19 #20

Merged
crimsen merged 28 commits from feature/migrations into develop 2023-03-02 05:37:11 +00:00
2 changed files with 10 additions and 7 deletions
Showing only changes of commit aa8f8f6e64 - Show all commits

View File

@ -41,9 +41,14 @@ def load_plugins(app: Flask):
for plugin in pluginController.get_enabled_plugins(): for plugin in pluginController.get_enabled_plugins():
logger.debug(f"Searching for enabled plugin {plugin.name}") logger.debug(f"Searching for enabled plugin {plugin.name}")
try: try:
# Load class
cls = plugin.entry_point.load() cls = plugin.entry_point.load()
if hasattr(cls, "blueprint") and cls.blueprint is not None: plugin = cls.query.get(plugin.id) if plugin.id is not None else plugin
app.register_blueprint(cls.blueprint) # Custom loading tasks
plugin.load()
# Register blueprint
if hasattr(plugin, "blueprint") and plugin.blueprint is not None:
app.register_blueprint(plugin.blueprint)
except: except:
logger.error( logger.error(
f"Plugin {plugin.name} was enabled, but could not be loaded due to an error.", f"Plugin {plugin.name} was enabled, but could not be loaded due to an error.",
@ -51,9 +56,7 @@ def load_plugins(app: Flask):
) )
continue continue
logger.info(f"Loaded plugin: {plugin.name}") logger.info(f"Loaded plugin: {plugin.name}")
app.config["FG_PLUGINS"][plugin.name] = cls.query.get(plugin.id) if plugin.id is not None else plugin app.config["FG_PLUGINS"][plugin.name] = plugin
app.config["FG_PLUGINS"][plugin.name].load()
def create_app(test_config=None, cli=False): def create_app(test_config=None, cli=False):
app = Flask("flaschengeist") app = Flask("flaschengeist")

View File

@ -226,7 +226,7 @@ class AuthPlugin(Plugin):
password: string password: string
""" """
raise MethodNotAllowed raise NotImplementedError
def delete_user(self, user): def delete_user(self, user):
"""If backend is using (writeable) external data, then delete the user from external database. """If backend is using (writeable) external data, then delete the user from external database.
@ -235,7 +235,7 @@ class AuthPlugin(Plugin):
user: User object user: User object
""" """
raise MethodNotAllowed raise NotImplementedError
def get_avatar(self, user) -> _Avatar: def get_avatar(self, user) -> _Avatar:
"""Retrieve avatar for given user (if supported by auth backend) """Retrieve avatar for given user (if supported by auth backend)