comparison MoinMoin/web/session.py @ 5580:af56baebf4d1

sessions: fix expiry check
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 23 Feb 2010 23:45:09 +0100
parents e535351eab08
children dba48cb280f9
comparison
equal deleted inserted replaced
5579:e535351eab08 5580:af56baebf4d1
304 store = self._store_get(request) 304 store = self._store_get(request)
305 if sid is None: 305 if sid is None:
306 session = store.new() 306 session = store.new()
307 else: 307 else:
308 session = store.get(sid) 308 session = store.get(sid)
309 now = time.time() 309 expiry = session.get('expires')
310 expiry = session.get('expires', 0) 310 if expiry is not None:
311 if expiry < now: 311 now = time.time()
312 # the browser should've killed that cookie already. 312 if expiry < now:
313 # clock not in sync? trying to cheat? 313 # the browser should've killed that cookie already.
314 self.destroy_session(request, session) 314 # clock not in sync? trying to cheat?
315 session = store.new() 315 logging.debug("session has expired (expiry: %r now: %r)" % (expiry, now))
316 self.destroy_session(request, session)
317 session = store.new()
316 logging.debug("get_session returns session %r" % session) 318 logging.debug("get_session returns session %r" % session)
317 return session 319 return session
318 320
319 def get_all_session_ids(self, request): 321 def get_all_session_ids(self, request):
320 store = self._store_get(request) 322 store = self._store_get(request)