Don't explicitly save sessions
authorNathan Kinder <nkinder@redhat.com>
Wed, 11 Mar 2015 23:51:29 +0000 (16:51 -0700)
committerSimo Sorce <simo@redhat.com>
Thu, 12 Mar 2015 19:36:33 +0000 (15:36 -0400)
Saving a session causes it to be unlocked, but sessions have a
hook that also performs a save just before the session is finalized.
In CherryPy 3.3.0 and later, an assertion was added to ensure that
a session is locked when trying to perform a save.  Since we perform
explicit saves in our code, this causes the assertion to be tripped
when the hook executes.

This patch removes our explicit save calls.  We should rely on the
hook to save and unlock the session.

https://fedorahosted.org/ipsilon/ticket/84

Signed-off-by: Nathan Kinder <nkinder@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
ipsilon/util/user.py

index fd557a0..1ce5c17 100644 (file)
@@ -154,7 +154,6 @@ class UserSession(Log):
 
     def save_user_attrs(self, userattrs):
         cherrypy.session['userattrs'] = userattrs
-        cherrypy.session.save()
         self._debug('Saved user attrs')
         self.userattrs = userattrs
 
@@ -171,7 +170,6 @@ class UserSession(Log):
     def save_provider_data(self, provider, data):
         attr = self._get_provider_attr_name(provider)
         cherrypy.session[attr] = data
-        cherrypy.session.save()
         self._debug('Saved %s provider data' % provider)
 
     def save_data(self, facility, name, data):
@@ -179,7 +177,6 @@ class UserSession(Log):
         if facility not in cherrypy.session:
             cherrypy.session[facility] = dict()
         cherrypy.session[facility][name] = data
-        cherrypy.session.save()
         self._debug('Saved session data named [%s:%s]' % (facility, name))
 
     def get_data(self, facility, name):
@@ -202,4 +199,3 @@ class UserSession(Log):
         else:
             del cherrypy.session[facility]
             self._debug('Nuked session facility [%s]' % (facility,))
-        cherrypy.session.save()