1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-20 23:41:20 +00:00

Remove config utils

This commit is contained in:
Mo 2022-05-29 21:17:24 +02:00
parent c67e15c367
commit f99354ba53
3 changed files with 0 additions and 28 deletions

View file

@ -32,7 +32,6 @@ from wtforms.widgets import NumberInput
from . import adminSpace, app, assistantSpace, db, user_datastore from . import adminSpace, app, assistantSpace, db, user_datastore
from .advlabdb_independent_funs import flashRandomPassword from .advlabdb_independent_funs import flashRandomPassword
from .configUtils import getConfig
from .customClasses import ( from .customClasses import (
CustomIdEndpointLinkRowAction, CustomIdEndpointLinkRowAction,
SecureAdminBaseView, SecureAdminBaseView,

View file

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

View file

@ -14,7 +14,6 @@ from flask_security.models.fsqla_v2 import FsRoleMixin, FsUserMixin
from sqlalchemy import select from sqlalchemy import select
from . import db from . import db
from .configUtils import getConfig
from .exceptions import DataBaseException from .exceptions import DataBaseException
from .model_independent_funs import get_first from .model_independent_funs import get_first