[chore] cleanup

This commit is contained in:
Ferdinand Thiessen 2021-03-24 18:37:53 +01:00
parent 1550be5da6
commit 7d692c5f68
3 changed files with 7 additions and 14 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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/<int:identifier>", methods=["GET"])