Rename SQLitedb to SQLiteDB

feature-admin-split
Darksider3 5 years ago
parent fb4b577eb8
commit b7ffedfba2

@ -31,7 +31,7 @@ def import_from_file(file_path: str, db: str, user_ids: tuple = tuple([])) -> bo
try: try:
with open(file_path, 'r', newline='') as f: with open(file_path, 'r', newline='') as f:
import lib.Validator import lib.Validator
sql = lib.sqlitedb.SQLitedb(db) sql = lib.sqlitedb.SQLiteDB(db)
err = lib.Validator.checkImportFile(file_path, db) err = lib.Validator.checkImportFile(file_path, db)
if err is not True: if err is not True:
print(err) print(err)

@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from lib.sqlitedb import SQLitedb from lib.sqlitedb import SQLiteDB
import configparser import configparser
import lib.uis.default as default_cmd # Follows -u, -a, -f flags import lib.uis.default as default_cmd # Follows -u, -a, -f flags
@ -20,7 +20,7 @@ class ListUsers:
:type approved: bool :type approved: bool
""" """
self.db = SQLitedb(db) self.db = SQLiteDB(db)
if unapproved: # only unapproved users if unapproved: # only unapproved users
query = "SELECT * FROM `applications` WHERE `status` = '0'" query = "SELECT * FROM `applications` WHERE `status` = '0'"
elif approved: # Approved users elif approved: # Approved users

@ -45,7 +45,7 @@ if __name__ == "__main__":
if not lib.Validator.checkUserInDB(args.user, db): if not lib.Validator.checkUserInDB(args.user, db):
print(f"User {args.user} does not exist in the database.") print(f"User {args.user} does not exist in the database.")
exit(1) exit(1)
DB = lib.sqlitedb.SQLitedb(db) DB = lib.sqlitedb.SQLiteDB(db)
sys_ctl = lib.System.System(args.user) sys_ctl = lib.System.System(args.user)
if not DB: if not DB:
print("Could not establish connection to database") print("Could not establish connection to database")

@ -71,7 +71,7 @@ def checkUserInDB(username: str, db: str) -> bool:
""" """
try: try:
ldb = lib.sqlitedb.SQLitedb(db) ldb = lib.sqlitedb.SQLiteDB(db)
fetched = ldb.safequery("SELECT * FROM 'applications' WHERE username = ?", tuple([username])) fetched = ldb.safequery("SELECT * FROM 'applications' WHERE username = ?", tuple([username]))
if fetched: if fetched:
return True return True

@ -11,7 +11,7 @@ def dict_factory(cursor, row):
return d return d
class SQLitedb: class SQLiteDB:
"""SQLitedb handles EVERYTHING directly related to our Database.""" """SQLitedb handles EVERYTHING directly related to our Database."""
db = "" db = ""
@ -156,7 +156,7 @@ class SQLitedb:
if __name__ == "__main__": if __name__ == "__main__":
try: try:
SQLitedb("bla.db") SQLiteDB("bla.db")
print("hi") print("hi")
exit(0) exit(0)
except KeyboardInterrupt: except KeyboardInterrupt:

Loading…
Cancel
Save