def clear_sessions(max_date, dry_run=False):
 session_collection = Session._storage[0].store
 query = {'date_modified': {'$lt': max_date}}
 if dry_run:
  logger.warn('Dry run mode')
 logger.warn('Removing {0} stale sessions'.format(session_collection.find(query).count()))
 if (not dry_run):
  session_collection.remove(query)

def clear_sessions ( max_date , dry_run = False ) : session_collection = Session . _storage [ 0 ] . store query = { 'date_modified' : { '$lt' : max_date } } if dry_run : logger . warn ( 'Dry run mode' ) logger . warn ( 'Removing {0} stale sessions' . format ( session_collection . find ( query ) . count ( ) ) ) if ( not dry_run ) : session_collection . remove ( query )
clear other sessions of the current user .