mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 02:08:36 +00:00
Fix session expiration ignored
This commit is contained in:
@@ -38,14 +38,20 @@ class RedisSessionStore(SessionStore):
|
|||||||
|
|
||||||
def save(self, session):
|
def save(self, session):
|
||||||
key = self.build_key(session.sid)
|
key = self.build_key(session.sid)
|
||||||
|
# `session` is the Werkzeug wrapper that contains
|
||||||
|
# the "real" session object `OpenERPSession`.
|
||||||
|
# That's why we need to look for the first item in it to get the
|
||||||
|
# expiration parameter
|
||||||
|
session_oe = session.itervalues().next()
|
||||||
|
expiration = getattr(session_oe, 'expiration', self.expiration)
|
||||||
|
|
||||||
if _logger.isEnabledFor(logging.DEBUG):
|
if _logger.isEnabledFor(logging.DEBUG):
|
||||||
_logger.debug("saving session with key '%s' and "
|
_logger.debug("saving session with key '%s' and "
|
||||||
"expiration of %s seconds",
|
"expiration of %s seconds",
|
||||||
key, self.expiration)
|
key, expiration)
|
||||||
|
|
||||||
if self.redis.set(key, dumps(dict(session), HIGHEST_PROTOCOL)):
|
if self.redis.set(key, dumps(dict(session), HIGHEST_PROTOCOL)):
|
||||||
return self.redis.expire(key, self.expiration)
|
return self.redis.expire(key, expiration)
|
||||||
|
|
||||||
def delete(self, session):
|
def delete(self, session):
|
||||||
key = self.build_key(session.sid)
|
key = self.build_key(session.sid)
|
||||||
|
|||||||
Reference in New Issue
Block a user