From 7d692c5f686486dc110ea97c91de771c9271db69 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 24 Mar 2021 18:37:53 +0100 Subject: [PATCH] [chore] cleanup --- flaschengeist/app.py | 12 +++++------- flaschengeist/plugins/events/__init__.py | 4 ++-- flaschengeist/plugins/pricelist/__init__.py | 5 ----- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/flaschengeist/app.py b/flaschengeist/app.py index 1ac1dab..2bdb2bb 100644 --- a/flaschengeist/app.py +++ b/flaschengeist/app.py @@ -16,19 +16,17 @@ from flaschengeist.controller import roleController class CustomJSONEncoder(JSONEncoder): def default(self, o): - # Check if custom model try: + # Check if custom model return o.serialize() except AttributeError: pass - if isinstance(o, datetime) or isinstance(o, date): return o.isoformat() if isinstance(o, enum.Enum): return o.value - - # Check if iterable try: + # Check if iterable iterable = iter(o) except TypeError: pass @@ -56,7 +54,7 @@ def __load_plugins(app): f"Plugin {entry_point.name} was enabled, but could not be loaded due to an error.", exc_info=True ) if isinstance(plugin, AuthPlugin): - logger.debug("Found authentication plugin: %s", entry_point.name) + logger.debug(f"Found authentication plugin: {entry_point.name}") if entry_point.name == config["FLASCHENGEIST"]["auth"]: app.config["FG_AUTH_BACKEND"] = plugin else: @@ -76,9 +74,9 @@ def install_all(): installed = [] for name, plugin in current_app.config["FG_PLUGINS"].items(): if not plugin: - logger.debug("Skip disabled plugin {}".format(name)) + logger.debug(f"Skip disabled plugin: {name}") continue - logger.info("Install plugin {}".format(name)) + logger.info(f"Install plugin {name}") plugin.install() installed.append(plugin) if plugin.permissions: diff --git a/flaschengeist/plugins/events/__init__.py b/flaschengeist/plugins/events/__init__.py index 0194c7a..91deac0 100644 --- a/flaschengeist/plugins/events/__init__.py +++ b/flaschengeist/plugins/events/__init__.py @@ -193,10 +193,10 @@ def get_event(event_id, current_session): @schedule_bp.route("/events", methods=["GET"]) @login_required() def get_filtered_events(current_session): - begin = request.args.get('from') + begin = request.args.get("from") if begin is not None: begin = from_iso_format(begin) - end = request.args.get('to') + end = request.args.get("to") if end is not None: end = from_iso_format(end) if begin is None and end is None: diff --git a/flaschengeist/plugins/pricelist/__init__.py b/flaschengeist/plugins/pricelist/__init__.py index 1d24715..5a8a831 100644 --- a/flaschengeist/plugins/pricelist/__init__.py +++ b/flaschengeist/plugins/pricelist/__init__.py @@ -24,11 +24,6 @@ class PriceListPlugin(Plugin): config = {"discount": 0} config.update(cfg) - def install(self): - from flaschengeist.database import db - - db.create_all() - @pricelist_bp.route("/drink-types", methods=["GET"]) @pricelist_bp.route("/drink-types/", methods=["GET"])