using 1.87.3
The script to remove old session files assumes a 1 hour expiration.
Sessions with 'remember me' have 30 day expirations. The following
unpacks the session data from the file to check for this (no logging):
EXPIRATION_MINUTES=60
import os, time, stat, cPickle
path = os.path.join(request.folder, 'sessions')
if not os.path.exists(path):
os.mkdir(path)
now = time.time()
for file in os.listdir(path):
filename = os.path.join(path, file)
if os.path.isfile(filename) and
file.startswith(('1','2','3','4','5','6','7','8','9')):
try:
t = os.stat(filename)[stat.ST_MTIME]
f = open(filename, 'rb+')
session_data = cPickle.load(f)
f.close()
except:
continue
try:
expiration = session_data['auth']['expiration']
except:
expiration = EXPIRATION_MINUTES * 60
if (now - t) > expiration:
try:
os.unlink(filename)
except:
pass