basic dynamic menu generation

This commit is contained in:
2019-11-18 01:06:28 -05:00
parent 48f5f347b1
commit 0dac14d7e1
6 changed files with 94 additions and 1 deletions

23
app/db.py Normal file
View File

@@ -0,0 +1,23 @@
import os
import sqlite3
db_path = '/usr/local/lib/bootbox/local.sqlite3'
class LocalDB(object):
def __init__(self, db_path = db_path):
self.db_path = db_path
self.conn = sqlite3.connect(self.db_path)
self.conn.row_factory = sqlite3.Row
self.cur = self.conn.cursor()
def getMenu(self, menu):
result = []
self.cur.execute('SELECT * FROM {0}'.format(menu))
for row in self.cur.fetchall():
result.append(dict(row))
return(result)
def close(self):
self.cur.close()
self.conn.close()
return()