diff --git a/tools.py b/tools.py index 67b5b1e..056aa84 100644 --- a/tools.py +++ b/tools.py @@ -31,19 +31,19 @@ class dbObject: return False -def dbCheck(path): - if dbInitialized(path): +def dbCheck(db): + if dbInitialized(db): return True raise ValueError("Provided database file " + path + " is not initialized. Create it using makedb.py or csvdb.py") def dbHelper(path): - dbCheck(path) - return dbObject(path) - - -def dbInitialized(path): db = dbObject(path) + dbCheck(db) + return db + + +def dbInitialized(db): return db.isInitialized()