I am trying to build a generic 'list_records' function to handle pagination
and to avoid doing it all over again for different queries and tables.
I am struggling to pass a proper query to the function eg.
request.vars.query = db.artikel.id > 0
ends up in the function as '(artikel.id > 0)' and not '(db.artikel.id > 0)'
which means that this code produces a malformed sql query (db(artikel.id
>0)...):
if request.vars.table and request.vars.query:
table = request.vars.table
start = page * items_per_page
stop = (page+1) * items_per_page+1
limitby = (start,stop)
query = request.vars.query
flds = request.vars.flds
print request.vars
if request.vars.total_found:
total_found = int(request.vars.total_found)
else:
total_found = db(query).count()
rows = db(query).select(flds,limitby=limitby)
Regards
Johann
--
May grace and peace be yours in abundance through the full knowledge of God
and of Jesus our Lord! His divine power has given us everything we need for
life and godliness through the full knowledge of the one who called us by
his own glory and excellence.
2 Pet. 1:2b,3a