Hi,
I have a question about what gets persisted when session data gets updated. I've read the sessions chapter of the book, and it's not entirely clear to me.
Say I have two keys in the session object that I'm manipulating in a view:
view1: request.session['foo'] = 'foocontent'
view1: request.session['bar'] = 'barcontent'
view1: goes off and does something that takes a long, long timer
Meanwhile some other view fires off and changes foo:
view2: request.session['foo'] = 'updateddfoocontent'
Then view2 exits, and the most recent session data gets persisted.
But meanwhile view1 still has the old copy of the session data. Eventually it completes whatever it was doing, and updates bar:
view1: request.session['bar'] = 'updatedbarcontent'
Question: when view1 exits and its data gets persisted, does it overwrite all of the session data, including stomping on view2's modification of foo? If so, how can I ensure that at the end of view1, what gets persisted is:
session['foo'] = 'updatedfoocontent'
session['bar'] = 'updatedbarcontent'
I'm using django 1.4 and db-based sessions.
Thanks in advance,
Spork