yes of course but Leonel your use-case looks very similar to the Auth case (i mean user_signature=true + @auth.requires_signature) . It's also a one hmac_key per user|client case. Actually i am not so much interested in why should a url be signed: what i'd like to achieve is mimic Auth signature case in the context of 'no-auth' signature. I've found this post:
https://groups.google.com/forum/#!msg/web2py/xnKA-4nnfeM/0OrWhCEInxsJ
and right now i am generating a session.hmac_key via auth.settings.login_onaccept = [generate_hmac_key] as Anthony suggested in this post
don't know if this is effective ?
i guess this forbids usage of both @auth.requires_login and session.forget() in the same function
signature is very confusing.........and so is the session object (when is it alive? when is it dead ?)
@auth.requires_login()
def main_func():
form = SQLFORM(db.atable)
if form.process(onvalidation=..., dbio=False).accepted:
rtn = scheduler.queue_task(task_func,….)
if not rtn.id: #there are errors
raise HTTP(404)
else:
redirect(URL('accept_func', args=[...]))
elif form.errors:
...
else:
...
accept_func calls an ajax: task_completed to test for task completion (rtn.id) every 5 seconds till task.status=='COMPLETED' or 'failure' (NOT COMPLETED after 5 calls)
If i make no mistake, there's a possiblity that auth.user expires before the entire process finishes so i am not sure it's a good idea to decorate accept_func (@auth.requires_login()) or task_completed (@auth.requires_signature())
right now accept_func works without decoration so it's mostly a 'task_completed signature issue'
i might have missed something since the beginning ?
@auth.requires_login()
def main_func():
form = SQLFORM(db.atable)
if form.process(onvalidation=..., dbio=False).accepted:
rtn = scheduler.queue_task(task_func,….)
if not rtn.id: #there are errors
raise HTTP(404)
else:
redirect(URL('accept_func', args=[...]))
elif form.errors:
...
else:
...
accept_func calls an ajax: task_completed to test for task completion (rtn.id) every 5 seconds till task.status=='COMPLETED' or 'failure' (NOT COMPLETED after 5 calls)
If i make no mistake, there's a possiblity that auth.user expires before the entire process finishes so i am not sure it's a good idea to decorate accept_func (@auth.requires_login()) or task_completed (@auth.requires_signature())
accept_func calls an ajax: task_completed to test for task completion (rtn.id) every 5 seconds till task.status=='COMPLETED' or 'failure' (NOT >COMPLETED after 5 calls)
accept_func is a web2py controller action, so it wouldn't be making Ajax requests, which must come from the browser. Is main_func an Ajax component (which would mean accept_func must also be an Ajax component)? Are you saying that once the accept_func component is loaded in the browser, it makes Ajax requests from the browser every 5 seconds to task_completed?
If i make no mistake, there's a possiblity that auth.user expires before the entire process finishes so i am not sure it's a good idea to decorate accept_func (@auth.requires_login()) or task_completed (@auth.requires_signature())
As long as you are making requests the login won't expire, as the expiration is measured from the time of the last request.
As long as you are making requests the login won't expire, as the expiration is measured from the time of the last request.I don't know the maths web2py uses to calculate this ?does this mean a logged in user is logged out only if he stays idle (make no request) for the duration of auth.setting.expiration ?
what happens if user loads the form (main_func) logged in and hits the submit button logged out ( he is been on the phone ) ?