better sessions2trash.py, thanks Jim

This commit is contained in:
mdipierro
2012-10-25 08:17:30 -05:00
parent fd16eb767e
commit 7ec816bf73
2 changed files with 4 additions and 8 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.2.1 (2012-10-24 16:04:05) stable
Version 2.2.1 (2012-10-25 08:17:22) stable
+3 -7
View File
@@ -23,6 +23,7 @@ Typical usage:
"""
from __future__ import with_statement
from gluon import current
from gluon.storage import Storage
from optparse import OptionParser
import cPickle
@@ -93,10 +94,7 @@ class SessionSetDb(SessionSet):
def get(self):
"""Return list of SessionDb instances for existing sessions."""
sessions = []
tablename = 'web2py_session'
from gluon import current
(record_id_name, table, record_id, unique_key) = \
current.response._dbtable_and_field
table = current.response.session_db_table
for row in table._db(table.id > 0).select():
sessions.append(SessionDb(row))
return sessions
@@ -121,9 +119,7 @@ class SessionDb(object):
self.row = row
def delete(self):
from gluon import current
(record_id_name, table, record_id, unique_key) = \
current.response._dbtable_and_field
table = current.response.session_db_table
self.row.delete_record()
table._db.commit()