# session id, and are generally noise
removed_sessions = set()
for key, value in request.session.items():
- if (isinstance(value, session.OpenERPSession)
- and not value._uid
- and not value.jsonp_requests
- and value._creation_time + (60*5) < time.time() # FIXME do not use a fixed value
- ):
+ if not isinstance(value, session.OpenERPSession):
+ continue
+ if getattr(value, '_suicide', False) or (
+ not value._uid
+ and not value.jsonp_requests
+ # FIXME do not use a fixed value
+ and value._creation_time + (60*5) < time.time()):
_logger.debug('remove session %s', key)
removed_sessions.add(key)
del request.session[key]
self._uid = False
self._login = False
self._password = False
+ self._suicide = False
self.context = {}
self.contexts_store = {}
self.domains_store = {}
req.session.assert_valid()
return None
+ @openerpweb.jsonrequest
+ def destroy(self, req):
+ req.session._suicide = True
+
def eval_context_and_domain(session, context, domain=None):
e_context = session.eval_context(context)
# should we give the evaluated context as an evaluation context to the domain?
n.warn.apply(n, arguments);
},
on_logout: function() {
- this.session.session_logout();
- $(window).unbind('hashchange', this.on_hashchange);
- this.do_push_state({});
- //would be cool to be able to do this, but I think it will make addons do strange things
- //this.show_login();
- window.location.reload();
+ var self = this;
+ this.session.session_logout().then(function () {
+ $(window).unbind('hashchange', self.on_hashchange);
+ self.do_push_state({});
+ //would be cool to be able to do this, but I think it will make addons do strange things
+ //this.show_login();
+ window.location.reload();
+ });
},
bind_hashchange: function() {
$(window).bind('hashchange', this.on_hashchange);
},
session_logout: function() {
this.set_cookie('session_id', '');
+ return this.rpc("/web/session/destroy", {});
},
on_session_valid: function() {
},