def index(): db = sqlite3.connect(dbPath) sf = sqliteAdminFunctions(db,tables=tables,extraRules=extraRules) res = sf.tableList(tables) if len(res) == 0: raise ValueError('No sqlite db and/or tables found at path = %s' % dbPath) else: return render_template('sqlite.html',res=res,title=title,h1=h1,baseLayout=baseLayout,bpName=bpName)
def api(): # create sqliteAdminFunctions object db = sqlite3.connect(dbPath) sf = sqliteAdminFunctions(db,tables=tables,extraRules=extraRules) # GET request if request.method == 'GET': q = request.args try: res = sf.tableContents(request.args['table'],request.args['sort'],request.args['dir'],request.args['offset']) return render_template('sqlite_ajax.html',data=res,title=title,h1=h1,baseLayout=baseLayout,bpName=bpName,q=q,qJson=json.dumps(q)) except Exception, e: return render_template('sqlite_ajax.html',error=e.message)