Simplify dbHelper
This commit is contained in:
parent
3feb8c0455
commit
a1d0c7fd97
1 changed files with 7 additions and 7 deletions
14
tools.py
14
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()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue