What is the Web2py way of making session variables unique to one browser tab? This example illustrates the problem.
Model: db.define_table('products', Field('quantity_on_hand', 'integer')) db.define_table('jobs', Field('job_yield', 'integer'), Field('product_id', db.products)) When a user updates the job_yield field, the jobs controller also needs to update quantity on hand in the products table. Usually one would use a session variable something like this. def edit(): # fetch current job yield old_job_yield = db.jobs[request.vars(0)].job_yield # save it in a session session.old_job_yield= old_job_yield ... if form.accepts(session,request): if request.post_vars.job_yield != session.old_job_yield: yield_delta = request.post_vars.job_yield - session.old_job_yield # assume we magically fetch related product id, then old_quantity_on_hand = db.products[product_id].quantity_on_hand new_quantity_on_hand = old_quantity_on_hand + yield_delta db(db.products.id==product_id).update(quantity_on_hand=new_quantity_on_hand) The problem arises if the user edits a different job in a different tab. Because there is only one instance of session.old_job_yield, the edit action in the other tab will overwrite it. What is the Web2py way of handling this problem? Thanks, Cliff Kachinske