Dear list, This is a question that was asked on Stackoverflow more than a week ago, but I haven't had an answer so I am posting this to the Django mailing list as well. http://stackoverflow.com/questions/15338103/django-session-values-occasionally-not-persisted<http://stackoverflow.com/questions/15338103/django-session-values-occasionally-not-persisted?noredirect=1#comment21668168_15338103>
I have the following REST method that update the value of the session every time a jQuery tab is clicked to store the active tab. @csrf_exempt def update_active_tab_request(request): """ Stores the active tab for a given tab item """ for tab, active in request.GET.iteritems(): request.session[tab] = int(active) return HttpResponse("OK", status=200) It's a fairly simple routine, and the issue I'm having is that it that the value is not always stored in the session. I have viewed the web server logs, and I've sprinkled logging statements to verify that the code is being called. Everything appears to be working, but I've found that there is a chance that the session has not been updated when this method returns. I'm using the default database session engine, though I have tried others and have not met with much success. I came up with a work around that involved by passing the session and writing the values directly into the cache. This works, but I'm unhappy with this work around. Not only that, this week I've discovered that there are other values in the session that are occasionally not being persisted correctly. Am I hitting a size limit somewhere? I originally discounted this as I'm using the database session engine and the session text is stored in a "text" column that can grow indefinitely. Perhaps I'm wrong? Could the contents of the session be invalidated somehow and thus revert to an old/stale copy? The values are only ever stored in the session in one location, and I've surrounded it with breakpoints and logging statements and I can verify that it looks OK. I'm (still) at a loss to explain what is going on. Any input would be much appreciated. Thanks, Phil -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.