From f99354ba53f8e929d6dd33f30bad06b58699808f Mon Sep 17 00:00:00 2001 From: Mo8it Date: Sun, 29 May 2022 21:17:24 +0200 Subject: [PATCH] Remove config utils --- advlabdb/adminModelViews.py | 1 - advlabdb/configUtils.py | 26 -------------------------- advlabdb/models.py | 1 - 3 files changed, 28 deletions(-) delete mode 100644 advlabdb/configUtils.py diff --git a/advlabdb/adminModelViews.py b/advlabdb/adminModelViews.py index 1ed0700..521caaa 100644 --- a/advlabdb/adminModelViews.py +++ b/advlabdb/adminModelViews.py @@ -32,7 +32,6 @@ from wtforms.widgets import NumberInput from . import adminSpace, app, assistantSpace, db, user_datastore from .advlabdb_independent_funs import flashRandomPassword -from .configUtils import getConfig from .customClasses import ( CustomIdEndpointLinkRowAction, SecureAdminBaseView, diff --git a/advlabdb/configUtils.py b/advlabdb/configUtils.py deleted file mode 100644 index 923e1e0..0000000 --- a/advlabdb/configUtils.py +++ /dev/null @@ -1,26 +0,0 @@ -import json - - -def getConfig(label): - with open("config.json", "r") as f: - return json.load(f)[label] # TODO: error handling - - -def setConfig(label, value, new=False): - with open("config.json", "r") as f: - config = json.load(f) - - if new and (label in config): - # Setting is not new! # TODO - return False - - if not new and (label not in config): - # Tried to update a setting which is new! # TODO - return False - - config[label] = value - - with open("config.json", "w") as f: - json.dump(config, f) - - return True diff --git a/advlabdb/models.py b/advlabdb/models.py index 4c21ab8..676d1b7 100644 --- a/advlabdb/models.py +++ b/advlabdb/models.py @@ -14,7 +14,6 @@ from flask_security.models.fsqla_v2 import FsRoleMixin, FsUserMixin from sqlalchemy import select from . import db -from .configUtils import getConfig from .exceptions import DataBaseException from .model_independent_funs import get_first