def chooseView():
# Form with two drop downs where user chooses parameters for the report
# Similar to index function from the URL provided below
if form.accepts(request.vars, session):
redirect(URL(r=request, f='viewReport', vars=request.vars))
def viewReport():
# Following is hack, wanna get rid of if possible
if request.args(0) in ['view']:
redirect(URL('default', 'viewRecordDetails', args=request.args, vars=request.vars))
# Checks like filter1, filter2 exists in request.vars
filter1 = requesr.vars.filter1
filter2 = requesr.vars.filter2
reportQry = db((db.table.field1 == filter1) & (db.table.field2 == filter2))
grid = SQLFORM.grid(reportQry.query, create=False, editable=False, csv=False, deletable=False, searchable=True)
return dict(grid=grid)
<Storage {'keywords': 'Text I searched'}>['view', 'table', '83']However I can do so because the user is required to click on links to move around the site (they can't guess the urls). That way I can control the variables stored on session.
I didn't understand your requirement fully (got lost halfway) when I posted this. So I am suggesting but I'm not sure if that will solve your issue.
--
--
When/where should I "clean" these variables from session ?In case user directly accesses second URL (without going thru first URL to select the search criteria) they might see incorrect results - since controller function will use "old" values
def url(**b):
b['args'] = args + b.get('args', [])
vars.update(b.get('vars', {}))
b['vars'] = vars
b['hash_vars'] = False
b['user_signature'] = user_signature
return URL(**b)
--