Ok, i was first storing the current session id from some insert statement, thanks now i can just access it directly from response.session_id.
I guess my logic is wrong since i am running all these queries in the same function, i end up inserting the current session_id and testing it against itself (expecting it to be different sometimes), which will not happen for any user session. Any idea of how i could set it up such that the next time a user logs in with a different session, then i can trigger some operation?? On Tuesday, October 4, 2016 at 6:13:24 PM UTC+2, Anthony wrote: > > On Tuesday, October 4, 2016 at 3:16:06 AM UTC-4, Meinolf wrote: >> >> Hi there, >> >> I need to update my table record only if the user is logged in with a >> different session from the previous, but with the code i have, it keeps >> updating when i thought the user still logged in with the same session. >> problem is i can't view the session id which seem to be encrypted, i can't >> tell when its the same and when its not. Did i miss something? below is my >> code: >> >> prev_ses_id = db((db.rates.user_id==auth.user.id) & >> (db.rates.item_id==request.args(0))).select(db.rates.ses_id) >> > > How and where are you setting the value of db.rates.ses_id? Do you expect > the above to return only a single record? Note, prev_ses_id is a Rows > object, not a Row object, and not an individual session id value. If you > want the value of the ses_id field, you need to do prev_ses_id[0].ses_id. > > Note, if you need the session id of the current session, it is in > response.session_id. > > Anthony > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.