Input validation work and error handling
This commit is contained in:
1 parent
4e2520ee76
commit
554b7cc82c
20 files changed
+627
-96
No files matched your search
+3
-2
@@ -1,12 +1,13 @@
|
||||
from flask import g, current_app
|
||||
from .database.sqlite import SQLite
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
def get_db():
|
||||
db = getattr(g, "_database", None)
|
||||
|
||||
if db is None:
|
||||
if str(current_app.config["config"]["database"]["type"]).casefold() == "SQLite".casefold():
|
||||
db = g._database = SQLite(current_app.config["config"]["database"]["name"])
|
||||
database = Path(current_app.config['CONFIG_DIRECTORY']) / current_app.config['config']['database']['name']
|
||||
db = g._database = SQLite(str(database))
|
||||
|
||||
return db
|
||||
Reference in new issue
Block a user