hmarr/mongoengine — pull request #477 by diver-in-sky (2012-04-04 23:12:44+00:00)
Title: Fix session data loss on first session save

Same implementation is in 'django/contrib/sessions/backends/db.py'.

Bug is here:

SessionStore#save() is called for new session
SessionStore#session_key is None so SessionStore#create() is called
SessionStore#save(must_create=True) called from SessionStore#create() and data from SessionStore#_session_cache is saved
but then original SessionStore#save() continues and rewrites session_data with empty SessionStore#_session_cache (it was cleared in SessionStore#create()).