Massive code refactoring, and some test rewrites.

This commit is contained in:
Mike Young
2019-11-15 14:45:42 -05:00
parent e012436011
commit d7279a73a7
127 changed files with 3960 additions and 345 deletions

14
app/lib/storage.py Normal file → Executable file
View File

@@ -3,18 +3,20 @@ import sqlite3
import sys
# sys.path.insert(1, '../')
from config import Config
from .config import Config
db_pointer = Config().catalogue_db
# db_pointer = Config().catalogue_db
class Storage:
class Storage():
"""Contains all methods for system storage"""
def __init__(self):
def __init__(self, db_pointer=None):
# Optionaly pass db_file to specify another db or for testing
if db_pointer is None: db_pointer = Config().catalogue_db
self.db_file = db_pointer
self.database()
self.create_tables()
# self.create_tables()
def database(self):
"""Create database cursor"""
@@ -23,6 +25,8 @@ class Storage:
self.cursor = self.db.cursor()
return True
except Exception as e:
print(self.db_file)
print(e)
return False
def create_tables(self):